Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Apache ignores ARGV[0] request

by digiryde (Pilgrim)
on Feb 08, 2005 at 14:46 UTC ( [id://429069]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Apache ignores ARGV[0] request
in thread Apache ignores ARGV[0] request

Most do run Apache, but most do not run mod_perl. This has to do with security issues on shared machines.

As far as cgi not working with Apache, that is probably a settings issue. First, mod_cgi has to be enabled in Apache, and secondly, the directory that your script is in has to be configured within apache (through a .conf file or a .htaccess file) to allow the execution of scripts.

These are not the only potential issues, permissions being another, but these are the ones most people have issues with the most. Is the configuration of your local machine set up to run the perl script as a cgi script? I would be willing to bet that the directory you have your script in is not set up to run cgi.

Something like this in a .htaccess file in the directory you want the script to run as a cgi:

DirectoryIndex index.pl Options +ExecCGI AddHandler cgi-script .cgi .pl
and then, in the httpd.conf somewhere, put
ScriptAlias /cgi-bin/ "/path/to/script/directory/"
You can use an index.pl script to log efforts to directly access the cgi-bin directory, create your own error page, or whatever. I use this to monitor for attempted cracks into the system. It has actually worked well in stopping some. Returning their IP address after a few tries on a page that says illegal access attempt logged scares most kiddies off. You can also do without it. The fewer things a stranger has access to, the safer you are.

I would develop the code in as much the same environment as what I was going to place it in, so if the host uses cgi-bin, I would use cgi-bin. This helps down the road by eliminating potential issues with differences in environments, like using mod_perl to develop in, but then using cgi to run in production. Bad combination. I would also try to keep my scripts in a directory that is not in the public_html path. Most hosts I work with allow that and it is much more secure.

Good luck to you.
digiryde

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://429069]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found