|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Newbie:Error While Accessing a C file through Apache
Dear
I am trying to access a C file through Apache But I am getting the error "HTTP 500 Internal Server Error" while i am accessing it through "www.mydomain/cgi-bin/Test" The following is the Simple C Code (Test.c) that I am trying to access #include<stdio.h> int i; main() { printf("Content-type: text/html \n"); printf("<html><head><title>Testing C Through Apache</title></head> \n"); printf("<body>Hello World!!</body></html> \n"); } I same code is running sucessfully from the console after I compiled and executed it. The permissions of the "cgi-bin" directory and the C file are correct (755) and all the Perl scripts in that same "cgi-bin" directory is working properly. This is the Directory tag inside the Virtual Host also I have specified the ScriptAlias tag <Directory "/home/www/users/mydomain/cgi-bin/"> AllowOverride None Options ExecCGI Order allow,deny Allow from all AddHandler cgi-script .pl .cgi .exe </Directory> Need I add anything for the C script to run through Apache. Please Help !! |
|
#2
|
|||
|
|||
|
1) I mentioned this dozen times a day, when your cgi-bin is ScriptAlias'ed, you don't set any option to it. So change the Options to None.
2) A <Directory> directive cannot have any trailing slash on the path. 3) You don't need to define AddHandler within <Directory>. 4) Your ScriptAlias line should be ScriptAlias /cgi-bin/ "/home/www/users/mydomain/cgi-bin/" |
|
#3
|
|||
|
|||
|
Dear
I made the changes that were mentioned above but still I am not able to run my C Script. The Perl program in the "cgi-bin" directory is executing properly. Problem is only for the C Program. |
|
#4
|
|||
|
|||
|
If you already made the changes then that's it for Apache. All I have to say is that, CGI can be written in any language, not just Perl. And you can run your compiled C code as a CGI.
As far as what caused you the 500 error (catch-all error which tells nothing), you'll know better than us by enabling ScriptLog directive. For example: ScriptLog /var/log/apache/script_log Note, this script_log needs to be writable by the User Apache runs as. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Newbie:Error While Accessing a C file through Apache |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|