This is a discussion on apache 2.0.52 (Fedora core 3) wont run CGI script... within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hi, Can't execute cgi script (no script simce to work) with apache 2.0.52 on Fedora 3. Anyone ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
Can't execute cgi script (no script simce to work) with apache 2.0.52 on Fedora 3. Anyone already met this problem ? ----------------------------------------------------- * about the scripts : [... cgi-bin]# ll total 16 -rwxr-xr-x 1 apache apache 99 Jan 5 14:34 test2.cgi -rwxr-xr-x 1 apache apache 435 Jan 5 14:31 test.cgi [... cgi-bin]# cat test2.cgi #! /bin/bash echo "ContentType: text/html" echo "" echo "<html><body><h1>test</h1></body></html>" [... cgi-bin]# cat test.cgi #!/usr/bin/perl -w print "Content-Type: text/html\n\n"; print <<HTML; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <h1>Test</h1> </body> </html> HTML [... cgi-bin]# pwd /var/www/cgi-bin [... cgi-bin]# ./test.cgi Content-Type: text/html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <h1>Test</h1> </body> </html> [... cgi-bin]# ./test2.cgi ContentType: text/html <html><body><h1>test</h1></body></html> (working with "su -s /bin/bash - apache" apache is the apache deamon user) ----------------------------------------------------- * apache conf: [...] ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" <Directory "/var/www/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> [...] et même : [...] AddHandler cgi-script .cgi <Directory "/var/www/html"> Options Indexes FollowSymLinks ExecCGI AllowOverride None Order allow,deny Allow from all </Directory> (cgi scripts dont work in cgi-bin, nor in DocumentRoot) ----------------------------------------------------- * server send error : Internal Server Error in the log : [Fri Jan 07 10:24:32 2005] [error] [client xxx.xxx.xxx.xxx] (13)Permission denied: exec of '/var/www/cgi-bin/test.cgi' failed [Fri Jan 07 10:24:32 2005] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: test.cgi ----------------------------------------------------- any ideas are welcome ! |
|
|||
|
In your test.cgi script, try to add an extra blank line so it's like this:
print "Content-Type: text/html\n\n"; print "\n"; Bing bipède wrote: > Hi, > > Can't execute cgi script (no script simce to work) with apache 2.0.52 on > Fedora 3. > > Anyone already met this problem ? > > > ----------------------------------------------------- > * about the scripts : > > [... cgi-bin]# ll > total 16 > -rwxr-xr-x 1 apache apache 99 Jan 5 14:34 test2.cgi > -rwxr-xr-x 1 apache apache 435 Jan 5 14:31 test.cgi > > [... cgi-bin]# cat test2.cgi > #! /bin/bash > > echo "ContentType: text/html" > echo "" > echo "<html><body><h1>test</h1></body></html>" > > [... cgi-bin]# cat test.cgi > #!/usr/bin/perl -w > > print "Content-Type: text/html\n\n"; > print <<HTML; > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <body> > <h1>Test</h1> > </body> > </html> > HTML > > [... cgi-bin]# pwd > /var/www/cgi-bin > > [... cgi-bin]# ./test.cgi > Content-Type: text/html > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <body> > <h1>Test</h1> > </body> > </html> > [... cgi-bin]# ./test2.cgi > ContentType: text/html > > <html><body><h1>test</h1></body></html> > > > (working with "su -s /bin/bash - apache" apache is the apache deamon user) > > ----------------------------------------------------- > * apache conf: > > [...] > ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" > > <Directory "/var/www/cgi-bin"> > AllowOverride None > Options None > Order allow,deny > Allow from all > </Directory> > [...] > > et même : > > [...] > AddHandler cgi-script .cgi > > <Directory "/var/www/html"> > > Options Indexes FollowSymLinks ExecCGI > AllowOverride None > Order allow,deny > Allow from all > > </Directory> > > (cgi scripts dont work in cgi-bin, nor in > DocumentRoot) > > ----------------------------------------------------- > * server send error : > > Internal Server Error > > in the log : > > [Fri Jan 07 10:24:32 2005] [error] [client xxx.xxx.xxx.xxx] > (13)Permission denied: exec of '/var/www/cgi-bin/test.cgi' failed > [Fri Jan 07 10:24:32 2005] [error] [client xxx.xxx.xxx.xxx] Premature > end of script headers: test.cgi > > ----------------------------------------------------- > > any ideas are welcome ! |
|
|||
|
Under Fedora Core 3, SELinux is enabled in its "enforcinfg" mode which
basically means that it is completely turned on with all security features enabled. Now, I haven't dealt with this myself since I am still at FC2, but I have read a couple of posts on a mailing list that I am on for a particular software package where others have had CGI-ish problems under FC3. If you are not familiar with SELinux, that's ok.. SELinux is a security layer that, when used properly, futher secures that linux box of yours down in a very good way. It does block file access (execute and write) to all files from the web server, despite what the local file permission settings are. I'm guessing this is the cause of your problem.. The solution that was presented on the mailing list (and, again, I have not been in the situation to try this) was to change the setting of SELinux from it's fully-enforce mode to it's warn-only mode. Changing this does require a reboot of the machine. |
|
|||
|
Rich wrote:
> Under Fedora Core 3, SELinux is enabled in its "enforcinfg" mode which > basically means that it is completely turned on with all security > features enabled. > > Now, I haven't dealt with this myself since I am still at FC2, but I > have read a couple of posts on a mailing list that I am on for a > particular software package where others have had CGI-ish problems > under FC3. > > If you are not familiar with SELinux, that's ok.. SELinux is a security > layer that, when used properly, futher secures that linux box of yours > down in a very good way. It does block file access (execute and write) > to all files from the web server, despite what the local file > permission settings are. I'm guessing this is the cause of your > problem.. > > The solution that was presented on the mailing list (and, again, I have > not been in the situation to try this) was to change the setting of > SELinux from it's fully-enforce mode to it's warn-only mode. Changing > this does require a reboot of the machine. > Yes thanks, that's it I turn it off and now it works... Dont have time to understand the policy configuration, I'm very tired of this kind of changes. Maybe Linux Fedora crew is very pleased with there new game, but that's not my case. :( |