Apache/Perl question
Tom Metro
blu at vl.com
Thu Aug 18 23:08:36 EDT 2005
Ronny Serrano wrote:
> A new requirement we have is to run some perl scripts on the box.
...
> For some reason I get a Forbidden or a 403 everytime...
The good news is that if you're seeing Forbidden, rather than the text
of the script, chances are good that Apache thinks it should be trying
to execute the file. (Of course you could also see this if you had
restrictive permissions on an HTML or other plain file.)
The first thing I'd recommend doing is trying to run the script from the
shell:
% cd /var/www/cgi-bin/
% ./script.cgi
and see what happens. You might get an error from the shell due to the
bang path (first line of the script) not pointing at your actual Perl
executable.
If the above works and you see some HTML or other non-error response
from the script, then try running the script as the Apache user. (Run ps
to find out what Apache child processes are running as, and su to it.)
I'd also highly recommend examining the Apache error log. You might find
errors in there, such as complaints about a missing suexec wrapper (a
helper program used to run scripts more securely), or other things that
are preventing script execution.
> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
[...]
>
> AddHandler cgi-script .cgi .pl
>
> On the options line I've tried ExecCGI, +ExecCGI and All.
> The directory/scriptalias points to the correct directory.
As someone else pointed out, if your scripts are in /var/www/cgi-bin/,
the ScriptAlias directive does everything necessary to make Apache
attempt to execute files in that directory, and the AddHandler/ExecCGI
directives are superfluous. They're used when you want to execute
scripts in non-ScriptAlias'ed directories.
> I've even tried changing the cgi-bin directory to 777 and making the
> user and group apache/apache
Are you sure your Apache child processes are actually running as user
'apache'?
-Tom
--
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: https://www.linkedin.com/e/fps/3452158/
More information about the Discuss
mailing list