Help - Search - Members - Calendar
Full Version: CGI not working
The Planet Forums > System Administration > Web Hosting
Blue|Fusion
I just got a quick CGI script to test and make sure it works, but sure enough it is not working.
http://supercoolhosting.com/test.cgi

I heard before about Plesk and suexec being problematic with httpd updates. Where do I get Plesk's suexec to replace the one that does not work?
Doodle
It doesn't appear to be and suexec problem. With suexec you would normally get a 500 error (UID/GID mismatch)

ScriptAlias is normally used to define whcih directory scripts can run from, however they can be run from any directory using the AddHandler directive. Also you'll probably need to add ExecCGI to the Options directive.

Scripts can be run server wide by uncommenting the following in httpd.conf
#AddHandler cgi-script .cgi

Alternatively you could add the following to .htaccess in any directory
Options ExecCGI
AddHandler cgi-script .cgi .pl
Blue|Fusion
My bad...forgot to put it in CGI-BIN, however there is still the Internal Server Error you were talking about.

http://supercoolhosting.com/cgi-bin/test.cgi
Blue|Fusion
I copied /usr/sbin/psa-suexec as /usr/sbin/suexec, but still no luck. Restarted Apache, too.

Any ideas?
Doodle
OK, that could be an suexec error. It should be listed in the suexec_log file as a mismatch error

target uid/gid (577/577) mismatch with directory (577/577) or program (0/0)

When the uid/gid match you would see the following in suexec_log

uid: (577/username) gid: (577/577) cmd: test.pl
Blue|Fusion
Here is /var/log/httpd/suexec_log:

CODE
[2004-08-23 19:57:00]: uid: (10002/supercool) gid: (10001/10001) cmd: test.cgi

[2004-08-23 19:57:00]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)

[2004-08-23 19:57:57]: uid: (10002/supercool) gid: (10001/10001) cmd: test.cgi

[2004-08-23 19:57:57]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)

[2004-08-23 20:00:57]: uid: (10002/supercool) gid: (10001/10001) cmd: test.cgi

[2004-08-23 20:00:57]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)

[2004-08-23 20:03:46]: uid: (10002/supercool) gid: (10001/10001) cmd: test.cgi

[2004-08-23 20:03:46]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)

[2004-08-23 20:05:17]: uid: (10002/supercool) gid: (10001/10001) cmd: test.cgi

[2004-08-23 20:05:17]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)

[2004-08-23 20:06:31]: uid: (10002/supercool) gid: (10001/10001) cmd: test.cgi

[2004-08-23 20:06:31]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)

[2004-08-23 20:06:32]: uid: (10002/supercool) gid: (10001/10001) cmd: test.cgi

[2004-08-23 20:06:32]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)


EDIT: I see it shows no execute permissions, however it is set to 744.
Doodle
CODE
[2004-08-23 20:06:32]: file has no execute permission: (/home/httpd/vhosts/supercoolhosting.com/cgi-bin/test.cgi)

Have you forgotten to make the file executable? chmod 755
Blue|Fusion
CHMODed to 755, still not working and no new messages in log file.
Doodle
Try running from a command line using SSH. The script works perfectly for me.

I'll send you a PM in a few minutes.
OCX
make sure the path to perl is the right path in the cgi file


/usr/bin/perl (this is the common place)

or
/usr/local/bin/perl
Blue|Fusion
which perl shows me /usr/bin/perl

Here is the file:

QUOTE
#!/usr/bin/perl

print "Content-type: text/htmlnn";
print "<HTML><HEAD>";
print "<TITLE>CGI Test</TITLE>";
print "</HEAD>";
print "<BODY><H2>I just wrote a web page using Perl!</H2>";
print "</BODY></HTML>";
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.