Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

In reply to Re^3: Apache ignores ARGV[0] request by digiryde
in thread Apache ignores ARGV[0] request by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-26 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found