Running perl scripts outside of cgi-bin
I know that the /cgi-bin/ directory normally gets aliased and all perl scripts are put in there... but I was wondering why this is. You don't put php or python scripts in some aliased and protected directory, why perl scripts? This seems to always just cause problems when trying to get perl script to work properly.
Anyways, some advice for the plesk users, if you are trying to run scripts outside of cgi-bin, add the following lines to your /home/httpd/vhosts/domain.com/conf/httpd.include file (within the <directory> directive block):
AddHandler cgi-script .pl .cgi
Options +Includes +ExecCGI
Make sure your perl scripts have a #!/usr/bin/perl statement as the first line, with just a \n at the end, not \r\n
Also check to make sure your script has correct ownership and execution privileges.
Lastly, make sure it is sending some kind of appropriate header to apache, such as Content-type: text/html\n\n
I also guess there is a way to add these lines to your web sites local .htaccess file and get the same result.
|