Help with CGI
Posted by: vigilante (---.phnx.qwest.net)
Date: July 26, 2007 09:05PM

Hi, I'm running WAMP 5_1.7.0.

I have to transfer, and update and edit a web site from one host to another. I have downloaded the entire site via their own archive utility, but before I upload it to the new host, I am updating, fixing and adding to the site on my OWN server running this version of WAMP.

So I have extracted all the files and tried to to run it as-is just for kicks, but am running into problems with their CGI scripts. Their cgi-bin was in the main public_html, and my sgi-big in registered in the apache2 folder in the root folder of my wamp install. I don't know how this affects running the cgis, because they are relatively called. For example in code when he runs a counter as just "cgi-bin/counter.cgi".
However, the cgis don't "run" they just open as plain text in the browser.

I have no experience with CGI, I use PHP and javascript and stuff, matter of fact I want to remove CGIs from this site. However, I do want to understand what's going on. I moved their scripts into the cgi-bin that is registered in httpd.conf but that didn't work. I don't know how to make sure my server is set up to interpret them, where the settings are, security, etc... I don't know why they are showing as plain text instead of being interpreted.

So if somebody could explain to me how WAMP deals with cgis, and what I need to do to enable them or whatever. Can I "test" my cgi install to make sure it's working? How?


Thanks!



On the edge of insanity

Options: ReplyQuote
Re: Help with CGI
Posted by: yfastud (---.mia.bellsouth.net)
Date: July 26, 2007 11:12PM

Search cgi + my username, you might run into my old posts for the solution. If still can't get it, email me

Have fun,

[www.jlbn.net] (Basic Guide for WAMP)

Options: ReplyQuote
Re: Help with CGI
Posted by: vigilante (---.phnx.qwest.net)
Date: July 31, 2007 07:10PM

OK it's fixed.

First off, for those people who come across this and need help, I'll summarize what has been said many times before, that worked for me:

I have WAMP 5 1.7.0, fairly default install.

There was no Perl plugin on WAMP's web page any more, some people from this forum said they installed a plugin from there, but it's not there when I looked. So I downloaded ActivePerl from [www.activestate.com]
Get the free download and you don't "have" to fill out the info to download it, but you should be nice and do it if you want.
Download the MSI installer and install it to C:\usr. The "usr" folder is better for portability and old standards I hear. But C:\perl (default) I guess is about the same.

After install, click your WAMP icon and open httpd.conf, do a search for:
"Options Indexes FollowSymLinks" and change it to:
"Options Indexes FollowSymLinks ExecCGI"

So add the "ExecCGI" on the end.

Then search for:
"#AddHandler cgi-script .cgi"
Or very close to it. Add the ".cgi" and also ".pl" so it's like this:
"AddHandler cgi-script .cgi .pl"

BE SURE TO REMOVE THE POUND SIGN!! I forgot that part and was part of my problem.

That's it for httpd.conf, save it and close, then restart all WAMP services.

Next, to test, run "[localhost];
It may not work, though, if not, find that file and open it up. At the very top you may see something like "#!D:\perl\bin\perl.exe" or something like that. Change this line to the proper path to perl.exe, which should be "#!C:\usr\bin\perl.exe".
Once the path is changed, try again, it should work this time and and show you some environment variables and stuff.

Note that you have to change this path at the top of ALL your perl/CGI scripts. There is a way to let scripts run from any folder, and there is a way to have Apache use registry file-type associations, but it is not recommended. So place all your CGIs in the cgi-bin folder, call them with "localhost/cgi-bin/..., and make sure the path to perl.exe is right at the top of all your scripts.

I got it working, hopefully this outline helps anybody else.

Thanks!



On the edge of insanity

Options: ReplyQuote


Sorry, only registered users may post in this forum.