Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Apache/Perl question

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 

% 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 

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 


Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile:

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /