homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

New perl installation - noob help
how to set your default folder

 6:47 pm on Jul 23, 2010 (gmt 0)

Hi there people of WebmasterWorld,

I have successfully got a .cgi file to print "IT WORKS" from my test file after some reading & tweaking of the httpd.conf file for Apache, the only thing is, Apache I notice has it's own cgi-bin folder.

My own installation functions so does this matter that I am not in the cgi-bin folder & when I do try to use the cgi-bin folder via "localhost/cgi-bin/test.cgi" it always says cannot find file. But outside of this folder & in the www directory (Wamp installation) the file functions fine :)

I'm just wondering if this matter particularly, because *technically* the perl installation works fine, just not in the directory I expected.

I have this line uncommented in httpd.conf:-

ScriptAlias /cgi-bin/ "C:/wamp/bin/apache/Apache2.2.11/cgi-bin/"

and if I use the h t t p://localhost/cgi-bin/test.cgi it doesn't work


h t t p://localhost/cgi_test/test.cgi it does!

So far as I am concerned I have succeeded the install, and shall now try to write a few basic things, but I also wonder - can you use perl in the same way as you do asp/php, IE: file extension tells the server that you have got asp/php content and that invokes the asp/php parser so you can write html then break into php when you need to, or is this language a different beast, and you can't use it in the same way as asp/php. Because I would like to see if I can produce the same thing in perl as I can in php.

Thank you for any pointers,




 11:39 pm on Jul 23, 2010 (gmt 0)
Using "cgi-bin" style directories is safer, but of course, you can.

AddHandler cgi-script .cgi .pl

For directory:
Options +ExecCGI

 7:22 am on Jul 24, 2010 (gmt 0)

Hi there Chorny,

I agree! The tutorial that I followed was pretty detailed, and now since I added the + to the ExecCGI, and .pl to the AddHandler, the page does now display with either file type extension (.pl or .cgi) which is better than last night!

But, I still get error 500 internal server error when I check the logs for accessing the "CGI-BIN" folder in the Apache directory:-
h t t p://localhost/cgi-bin/hello.cgi
(left path structure intact as nothing revealing in path)

[client] (OS 5)Access is denied. : couldn't spawn child process: C:/wamp/bin/apache/Apache2.2.11/cgi-bin/hello.cgi

So now I would just like to see if I can get the "test" file to function both in the "CGI-BIN" folder and out of it (if that's possible) then I can start trying some code out :)

Thanks for the assistance,



 1:37 pm on Jul 24, 2010 (gmt 0)

do you have the

AddHandler cgi-script .cgi .pl


Options +ExecCGI

directives in directory context or any other limited context or do they apply globally?


 6:46 pm on Jul 26, 2010 (gmt 0)

Hi there Phrangue,

I have both of those directives in the httpd.conf file, which at present results in the aforementioned error being placed in the error log.

I'm unsure what you mean by globally (or even how to set that as global), could you elaborate on that please.

Thanks for the continued assistance,



 11:22 pm on Jul 26, 2010 (gmt 0)

are these directives specified within any Configuration Section Containers [httpd.apache.org]?

for example the AddHandler Directive [httpd.apache.org] may be specified within virtual host or directory contexts.


 7:56 pm on Jul 27, 2010 (gmt 0)

Hi all,

UPDATE! a Spellink eror on my part was to blame! I had put ExeCGI and not ExecCGI, it now seems to work, and my Perl book from O'Reilly has arrived, Woo!

I'm just wondering though, can you embed perl like you can with php? I have read that there are modules that you can install, but it seems rather complicated to me? Any pointers would be great.

Thank you for the help.



 12:59 pm on Jul 28, 2010 (gmt 0)
What do you mean by "embed"? Inside HTML? You can, but it is considered very bad practice - only PHP programmers seriously use this. Check Template Toolkit for good code.

 8:27 pm on Jul 28, 2010 (gmt 0)

Hi there chorny,

Well, meaning something like this:-

<?perl print $title;?>

I have googled Template Toolkit, and the server is down :(

I'm totally new to this & it's just something I am trying out for work, because this is going to be the framework for an intranet that I am trying out - if I can't work it out, I shall write it in php, and use perl as and where I can (up to the scope of my ability of course) and see how I get on from that.



 9:18 am on Jul 29, 2010 (gmt 0)

To install Template Toolkit [search.cpan.org] do `install Template` in CPAN client. It is best option. If you want to use bad style, you can try HTML::Mason - OO solution for templates, or Embperl (which requires mod_perl) or search on CPAN for yourself [search.cpan.org]. Template Toolkit also allows using bad style, but it requires enabling it in options.


 9:51 am on Jul 29, 2010 (gmt 0)

Hi there Chorny,

Thanks for the advice, I shall have a play with the suggestions and see what I come up with.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved