Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-07-2005, 11:37 AM   #1
Registered: Dec 2004
Location: Ontario, Canada
Distribution: ArchLinux, VectorLinux, Ubuntu, Debian, Linspire
Posts: 66

Rep: Reputation: 15
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/ 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.
Old 09-08-2005, 05:34 AM   #2
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
It's a good idea to put all scripts in a seperate, protected directory; there's nothing special about Perl scripts, and you should do this for PHP and python scripts too.

The reason is that, should your script contain a security vunrability (and you should always assume that it does), then anyone gaining access to the system will probably have only the privalages available to the running script. So they won't be able to do anything more than trash your CGI-bin directory, whereas if you put them in an unprotected directory, then they can do much more damage.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems in running cgi/perl scripts... raymond Linux - General 17 02-09-2010 05:06 AM
Where do I put my cgi-bin scripts? BrianK Linux - Software 2 10-12-2005 11:59 PM
Of Perl CGI scripts and Sendmail Chrax Programming 2 06-06-2005 05:21 PM
.CGI scripts enabled with #!/usr/bin/perl -i?? computerdaves Fedora 8 02-18-2005 05:03 PM
Running Perl/CGI scripts hso_sof Linux - Newbie 3 08-22-2003 11:26 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:18 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration