PDA

View Full Version : cgi-bin -error 500



locateMe
02-13-2004, 05:30 AM
I hope someone can help me :)

I have a uploaded a web site and it is working just fine - however I have now installed a bulletin board (YaBB) into the cgi-bin but every time I try and run it I get a Server Error 500.

I then tried to upload just a simple gif which displays perfectly ok at the root of the web site but as soon as I put it into the cgi-bin and view it in the browser I get the same Server Error 500.

This happens for any file type that is put into cgi-bin - html, gif, jpg and .pl files all return Server Error 500

So methinks it's something to do with the file permissions but I have tried all combinations from 755 to 777 with the same results.

Any ideas?

Thanks

Steve

locateMe
02-13-2004, 06:08 AM
OK, just solved my own problem

It appears that if any files or folders under cgi-bin have a permission of > 755 then it stops the whole folder from working.

Would be nice if a friendly error message was displayed LOL

Steve

DirectAdmin Support
02-13-2004, 10:28 AM
Hello,

Yes, suexec has the most cryptic errors. The "friendly" error would be located in /var/log/httpd/suexec_log .. but you may, or may not have access to that.

John

l0rdphi1
03-07-2004, 02:03 AM
Okay, 500 error here too, /var/log/httpd/suexec_log:
[2004-03-07 04:01:59]: info: (target/actual) uid: (admin/admin) gid: (admin/admin) cmd: coranto.cgi


[root@server1 testing]# perl -c coranto.cgi
coranto.cgi syntax OK

l0rdphi1
03-07-2004, 11:41 AM
this shows in the httpd error_log:
[Sun Mar 7 13:35:11 2004] [error] [client 12.108.101.87] Premature end of script headers: /....../coranto.cgiBut the header is obviously being outputted:
[root@server1 testing]# perl coranto.cgi
Content-type: text/html
Expires: Sun, 07 Mar 2004 18:41:26 GMT


<html><head><title>[..]Any ideas?

DirectAdmin Support
03-07-2004, 09:48 PM
What about:

./coranto.cgi

(intstead of shoving it through perl yourself, let the first line figure it out)..so just double check the interpreter. Other than that, just check the permissions on the file.. not too sure.

John

l0rdphi1
03-07-2004, 09:51 PM
[root@server1 test]# ./coranto.cgi
: bad interpreter: No such file or directory

DirectAdmin Support
03-07-2004, 10:39 PM
Ah.. whats the first line say? Should be something like:

#!/usr/bin/perl

John

l0rdphi1
03-07-2004, 10:40 PM
It's: #!/usr/bin/perl

:)

DirectAdmin Support
03-07-2004, 10:47 PM
If that's a new FreeBSD system, you may need to link /usr/bin/perl to /usr/local/bin/perl


use.perl portOR
ln -s /usr/local/bin/perl /usr/bin/perl

John

l0rdphi1
03-07-2004, 11:02 PM
It's a redhat 9 box. Should I still set up that slink?

The other thing, apparently this Perl file is in [dos] format, could that be doing it?

DirectAdmin Support
03-08-2004, 12:03 PM
If /usr/sbin/perl exists as a binary, then it should be fine as is.. and yes, if the files are dos, it would be worth just editing the first line the file to use \n instead of \r\n .. might be causing your grief.. I know I had to change that exact same thing in the skins scripting system for that reason. (accomodates both now)

John

l0rdphi1
03-08-2004, 01:13 PM
That did it! (s/\r\n/\n/g)

Thank you, John :)

l0rdphi1
03-28-2004, 07:02 PM
Ahh.. hmm - The *same exact* setup is working fine in a subdirectory of public_html, but is not working in public_html:
[2004-03-28 21:01:23]: error: target uid/gid (500/500) mismatch with directory (500/0) or program (500/500)
Any ideas?

DirectAdmin Support
03-29-2004, 12:06 PM
Looks like the public_html is group root. Set it to group # 500 (username)

John

l0rdphi1
03-29-2004, 12:08 PM
That's odd, but makes sense. Thanks.