PDA

View Full Version : cgi-bin not working



Guust
01-23-2004, 11:01 AM
cgi-bin is not working on our new server.
I get this error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@***.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/1.3.29 Server at www.***.com Port 80

What can I do about this? Reinstall cgi-bin? And how?

thanx

Guust Hilte
Safe2Surf

DirectAdmin Support
01-23-2004, 11:15 AM
Hello,

Check the permissions on everything (755 at most, 777 will not work). Owner also must be the owner of the account.

Check /var/log/httpd/suexec_log for details on the error.

John

Guust
01-23-2004, 11:22 AM
Originally posted by DirectAdmin Support
Hello,

Check the permissions on everything (755 at most, 777 will not work). Owner also must be the owner of the account.

Check /var/log/httpd/suexec_log for details on the error.

John

it's not the permissions, because every account has this on our server. I dubble checked the permissions on every account but cgi bin just doesn't work.

DirectAdmin Support
01-23-2004, 11:49 AM
Check the log as mentioned above.

John

S2S-Robert
01-23-2004, 04:14 PM
[2004-01-20 16:56:23]: info: (target/actual) uid: (<username>/<username>) gid: (<username>/<username>) cmd: forum.cgi
[2004-01-20 16:56:23]: error: file has no execute permission: (/home/<username>/domains/<username>.nl/public_html/cgi-bin/forum.cgi)

While:


[root@server cgi-bin]# ls -al
...
-rwxr-xr-x 1 <username> <username> 5547 Jan 18 23:41 forum.cgi
...
-rwxr-xr-x 1 <username> <username> 5089 Jan 21 18:00 guestbook.cgi


And like Guust said, it's not the only user experiencing this error, there are more. Know where to look?

DirectAdmin Support
01-24-2004, 12:22 PM
Hello,

Also double check the permissions of the cgi-bin directory.

I had a look at the actual suexec.c code, for any programmers, here it is:


/*
* Error out if the program is not executable for the user.
* Otherwise, she won't find any error in the logs except for
* "[error] Premature end of script headers: ..."
*/
if (!(prg_info.st_mode & S_IXUSR)) {
log_err("error: file has no execute permission: (%s/%s)\n", cwd, cmd);
exit(121);
}Which does in fact point to the file itself.. so double check the path you're using.

John

Guust
01-25-2004, 04:08 AM
hmm, we just moved EVERY thing from our old server to the new server and now is cgi not working. Also not working for the new account(that doesn't used the backupfunction). Isn't there a way to reinstall cgi or reconfiger cgi or something? Because I strongly think we just don't even got cgi on our server.

S2S-Robert
01-25-2004, 08:15 AM
drwxr-xr-x 4 <username> <username> 4096 Jan 18 04:19 cgi-bin

So that seems correct right?

DirectAdmin Support
01-25-2004, 01:15 PM
Hello,

If the /var/log/httpd/suexec_log is being filled up with data, then you do have cgi's on your server. Just keep an eye on that log, or your domain error logs for possibly reasons why things don't run.

Also, if everything else seems to be working correctly, try running the script from the command prompt, in case there are things that are dying before the script gets a chance to finish (ie: included modules that don't exist:


cd /home/username/domains/domain.com/public_html/cgi-bin
./script.cgi
Re: Permissions, yes that cgi-bin folder looks correct.

John

S2S-Robert
01-25-2004, 04:18 PM
[root@server cgi-bin]# ./forum.cgi
Can't locate CGI.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0) at ./forum.cgi line 16.
BEGIN failed--compilation aborted at ./forum.cgi line 16.

DirectAdmin Support
01-26-2004, 09:13 AM
http://www.directadmin.com/forum/showthread.php?s=&threadid=764&highlight=dbi

John

ProWebUK
01-26-2004, 11:42 AM
For future reference the fix was:

# perl -MCPAN -e shell
# cpan> install CGI

however, in this case it was the actual CGI and CGI::* modules missing.... there are others but that covers the main cgi.pm problem :)

Chris

Guust
01-26-2004, 02:54 PM
Originally posted by ProWebUK
For future reference the fix was:

# perl -MCPAN -e shell
# cpan> install CGI

however, in this case it was the actual CGI and CGI::* modules missing.... there are others but that covers the main cgi.pm problem :)

Chris

thanx for fixing:D

DirectAdmin Support
01-27-2004, 09:10 AM
Oh :) wups.. hehe, I posted DBI.. not quite CGI.. well, maybe if you squint ;)

John

Aziz
01-24-2006, 07:41 AM
Originally posted by ProWebUK
For future reference the fix was:

# perl -MCPAN -e shell
# cpan> install CGI

however, in this case it was the actual CGI and CGI::* modules missing.... there are others but that covers the main cgi.pm problem :)

Chris

I did those two and still it gives me the same error, in the log file:

[2006-01-24 10:36:24]: uid: (500/admin) gid: (500/500) cmd: v.php

without errors?

Peace,