Hi,
I am having big troubles making the CGI script working on my apache
v. 1.3.29 under Open BSD unix 3.7. I am logging using the root account. The webpage itself (html) loads default - from the var/www/htdocs directory and it works fine.
But when I try to call a CGI script for example: lynx 127.0.0.1/cgi-bin/test3.cgi
I am still getting the 500 - internal server error message.
When I watch error logs file I found there just like:
[Sun Aug 6 10:49:28 2006] [error] [client 127.0.0.1] Premature end of script headers: /cgi-bin/test3.cgi
[Sun Aug 6 10:49:47 2006] [error] [client 127.0.0.1] Premature end of script headers: /cgi-bin/test3.cgi
messages.
The script I am trying to make running is very simle:
it is not PERL but I also tried some in PERL and also works not. This my script is in simple c, here it is:
for example test3.c file:
main ()
{
printf ("Content-type: text/plain\n\n");
printf ("hello, world\n");
return 0;
}
thats all. I compile it using c test3.c -o test3.cgi
I change the permissions using:
chmod a+x test3.cgi
When I run it from system shell it works well:
Here is the OUTPUT:
Content-type: text/plain
blank line
hello, world
Then I run httpd, and then run for example lynx 127.0.0.1/cgi-bin/test3.cgi I am still getting error message.
I made following changes in my httpd.conf:
Options All
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi .pl
thats all I think.
I was also trying to run some other scripts, for examle, there was 2 default PERL script in the cgi-bin
directory: test-cgi and printenv, I changed their using chmod +x and renamed to .pl , but when I try to
run then , I am still getting the same error message 500-int. serv. error and Premature end of script headers
in the log file .
Where can be the problem? Have I to change something? Made I some mistakes?
Please help
THX a lot