CGI File Extensions

CGI File Extensions

Posted by: jfreiberg
Posted on: 2008-02-18 05:52:00

I am new to Apache, and need some basic guidance. I want to be able to run some perl cgi files that have an extension of ".pl". If I rename them to ".cgi", they work fine, but I need to run them as ".pl". I added the line "AddHandler cgi-script .pl" to the .htaccess in the directory that contains the file, but that doesn't seem to work. I have a cludgy workaround. If I create a directory with a .pl extension, for instance "test.pl", and place my script in that directory with the name "index.cgi" and a .htaccess file containing the line "Options +ExecCGI", i get what I want, but there has to be a better way, I just don't know what it is. BTW I wasn't sure I needed the "." in the addhandler, so I also tried the command "AddHandler cgi-script pl", but that didn't work either.

Any help would be appreciated.

Re: CGI File Extensions

Posted by: rlparker
Posted on: 2008-02-18 06:22:00

In the default DreamHost apache setup, ".pl" files (that have 755 permissions and the correct shebang!) *should* "just work" right out of the box (without you having to do anything else).

You might want to drop tech support a line and have then check to see if something is not set up correctly with your instance of apache.

--rlparker

Tags: htaccess fileperl cgiline optionsfile extensionsworkaroundguidanceapachehtaccess fileperl cgiline optionsfile extensionsworkaroundguidanceapache