Check permissions. for group and others
# ls -l ./script.cgi
Check who the cgi runs as.
add a line somewhere that says
print STDERR 'i am running as: '. `whoami`;
go to your terminal and do :
# tail -f /var/log/httpd/error_log
then call the script from the browser- you'll see the messages as they come out.
Keep in mind your log may be elsewhere, but should be easy to find. If you are using ssl, it is in ssl_error or so.
Sometimes the script *must* be named whatever.cgi, .pl extennsion will not run. Depends on server setup.
When you use the cli, the script is running as the invokee (unless with sudo, but that's kinda outta scope). That means if you log in as joe, and you run sue.pl, sue.pl runs with joe's permissions.
But when you call this via a browser... aha.. it may not be running as 'joe', it may be running as 'apache' or "sue". And apache and "sue" may not have the permissions to do what your script is trying to do- maybe even run!
Where is the script? It may have to be in cgi-bin, some servers are configured to demand that. If so, make sure this is there.
You can make a cgi-bin dir alongside public_html(like) and then make a soft link in public_html/cgi-bin to that one.. that may work it in such case.
In reply to Re: CGI script returns no values in browser but is ok on command line?
by leocharre
in thread CGI script returns no values in browser but is ok on command line?
by gudmo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |