Forum Moderators: phranque

Message Too Old, No Replies

perl script does not execute, just prints the script

         

perlmonger

9:12 am on Mar 10, 2012 (gmt 0)

10+ Year Member



Hi,

I set up Apache 2.2 and Perl 5.xx on a Windows XP notebook. I was able to get Apache to serve web pages out of its htdocs folder and perl to run out of its cgi-bin folder.

Now I am trying to move the source folders of the html and perl to another folder on the C: drive as if it was configured on a website, not in the Apache 2.2 folder. Changes were made to httpd.conf to accomplish this. I am able to get the html pages to be served out of its new folder like C:/vic/public but cannot get perl scripts to run out of C:/vic/cgi-bin. Apache finds the html and perl scripts, serves web pages, but prints the perl script as text (does not execute the script but just prints it out).

I think I looked at 50 websites for help on this but now must resort to my own request. Thanks for any help!

phranque

11:07 am on Mar 10, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, perlmonger!

you'll probably need something like this in your server config file:

<Directory C:/vic/cgi-bin>
Options ExecCGI
SetHandler cgi-script
</Directory>

perlmonger

5:19 am on Mar 23, 2012 (gmt 0)

10+ Year Member



Many thanks! After combing through the httpd.conf file a few more times, perl now runs!

phranque

9:19 am on Mar 23, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



glad to hear it!
did you need more than ExecCGI and SetHandler?

perlmonger

7:11 am on Mar 24, 2012 (gmt 0)

10+ Year Member



Hi Phranque,

I spent six hours going over the httpd.conf file using as much help as I could find on the internet and couldn't get the scripts to run, they'd just print themselves out.

Then I went to my local linux user group meeting and spent three hours with a linux/apache helper (although the PC was running Windows).

Then I asked for help on this forum.

Then I noticed that the scripts WERE running! Sometime during the linux/apache session, the script started running. I'll admit it, we were pretty fried by the end of the evening. The script we were attempting was printenv.pl which prints the environmental variables. I didn't look real close, there's not much difference between perl printing the script or printing the same script with the values present. So the scripts run now.

Okay, I'll admit one more thing; usually when a problem is solved, we go on to the next thing without really understanding what makes the scripts run. Except this time, I'll go back and reverse my changes one at a time to see what makes them work.

There are perhaps six changes to make in the httpd.conf file. A couple have to do from where Apache thinks the webpages are being served. The others have to do from where .cgi and .pl are being served.

So I'll try to report back soon. Meanwhile, I posed another Apache question about Firefox downloading a file instead of passing it to the application it opens; if Firefox "serves" the file without Apache's help, it passes the file to the application it opens.

phranque

9:29 am on Mar 24, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



remember that you will want to restart the server and clear your browser cache whenever you edit the httpd.conf file.
and if your server has any kind of cache module running clear out that cache as well for each test.