GetDotted Domains

Viewing Thread:
"CGI on Apache on Win XP"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Wed 12/06/02 at 10:04
Regular
Posts: 787
I have installed Apache 1.3.20 on Windows XP Home Edition, including PHP 4.2.1. The directory in which I store web sites is c:htdocs but I can't seem to get CGI working at all - I have tried running .cgi and .pl files from c:htdocscgi-bin c:Program FilesApache GroupApachecgi-bin and c:cgi-bin but it doesn't work!

Could someone please tell me what I need to set up and how to do it in order for it to work. I have been throught the apache config files and told it to run all CGI scripts from c:htdocscgi-bin, yet it won't even recognise they are there, let alone give me a compiling error!

I would also be grateful if someone could send me a CGI file to test it - just a "Hello World" one. I haven't learnt CGI yet, so I don't know if the script I got from the internet has an error...
Fri 14/06/02 at 12:58
Posts: 0
dont worry, ive got it working now - thanks for your help everyone though!

i dunno what i did, it just started working.... weird...
Fri 14/06/02 at 11:18
Posts: 0
OK, ive downloaded and installed ActivePerl from ActiveState in its default directory (c:\perl\). then i went to the apache config file (httpd.conf) and set the perl directory to "c:\perl\bin" which is the directory that contains the file "perl.exe". Then I restarted my server.

However, when I run a .pl file (such as the example file they include with ActivePerl) from Internet Explorer, it simply asks me if i would like to download the program, and then open or save it. if i select open, it runs it using the command line, and if i save it, it just saves the file on my HDD. how do i make it execute the file rather than download?

please help...
Wed 12/06/02 at 19:41
Regular
"Devil in disguise"
Posts: 3,151
Nimco wrote:
> OK, I've just done a search of my hard drive, and i dont have perl.exe
> anywhere! i would hazard a guess this has something to do with it.
> where can i download it from?
>
> btw, i looked in the error logs, and this is the error i got:
>
> [Wed Jun 12 17:39:28 2002] [error] [client 192.168.0.2] couldn't spawn
> child process: c:/htdocs/cgi-bin/printenv.cgi

Yeah, something to remember, CGI isn't a language. Its just a standard for interfacing with external applications like Perl, you can equally run PHP with CGI too if you wish or any program you want for that matter.

For windows, I guess you want to download ActivePerl (don't really know of any other perl implementations for windows sorry). You can get that from activestate.com. Download and install Perl, and then in the top line of your CGI script just put the path to the perl executable (might be you need to change something in the apache config too, depends if you've set up anything telling it what to spawn with certain extensions).

-G
Wed 12/06/02 at 19:04
Posts: 0
OK, I've just done a search of my hard drive, and i dont have perl.exe anywhere! i would hazard a guess this has something to do with it. where can i download it from?

btw, i looked in the error logs, and this is the error i got:

[Wed Jun 12 17:39:28 2002] [error] [client 192.168.0.2] couldn't spawn child process: c:/htdocs/cgi-bin/printenv.cgi
Wed 12/06/02 at 18:55
Regular
"Devil in disguise"
Posts: 3,151
Well, the thing to do is to check the logs directory and see if you have an error.log file (which you should have unless you've turned it off). Your perl script is ok, only thing I can see from what you've provided is that it doesn't like you having c: at the front of the path to perl, try just #! /Program Files/Perl/perl.exe or whatever the path to the exe is. Its probably case sensitive too.

Btw, just noticed from your first post, you won't get compile errors shown in your browser like you are used to in PHP, if the script execution fails (due to syntax errors or whatever) apache usually just returns an internal server error. You can change it, but I think the default setting is as I said.

-G
Wed 12/06/02 at 17:48
Posts: 0
yes, it definitely works. i have been running apache on win xp home since january. it works with php, xml, gd etc etc. only cgi returns an error. i get this error when trying to load: http://matthew/cgi-bin/printenv.cgi

-------
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

-------------------------

Apache/1.3.20 Server at matthew Port 80
-------

file contents:
______________
#!c:/program files/perl/perl
##
## printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
______________
Wed 12/06/02 at 17:32
Regular
"l33t cs50r"
Posts: 2,956
funkygamer wrote:
> I know PWS only works on the PRO version of XP, because M$ thought
> that only "pro" users would want to run a local web server.
> I know it is a long shot, but are you sure the Apache version you are
> using works with XP? I've never used Apache on Windows, so can't be
> much more help than that.

Apache definately works on XP Pro as I run it at work, but there is a big difference between Pro and Home with these things. hence why IIS only comes on XP Pro.
Wed 12/06/02 at 17:20
Posts: 0
I know PWS only works on the PRO version of XP, because M$ thought that only "pro" users would want to run a local web server. I know it is a long shot, but are you sure the Apache version you are using works with XP? I've never used Apache on Windows, so can't be much more help than that.
Wed 12/06/02 at 17:06
Regular
"Devil in disguise"
Posts: 3,151
Nimco wrote:
> I have installed Apache 1.3.20 on Windows XP Home Edition, including
> PHP 4.2.1. The directory in which I store web sites is c:htdocs but I
> can't seem to get CGI working at all - I have tried running .cgi and
> .pl files from c:htdocscgi-bin c:Program FilesApache
> GroupApachecgi-bin and c:cgi-bin but it doesn't work!
>

Define "it doesn't work". :)
Is your browser returning an error or is it just serving up the files without processing them. Also what does the apache log say to these requests?

-G
Wed 12/06/02 at 16:39

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

The coolest ISP ever!
In my opinion, the ISP is the best I have ever used. They guarantee 'first time connection - everytime', which they have never let me down on.
My website looks tremendous!
Fantastic site, easy to follow, simple guides... impressed with whole package. My website looks tremendous. You don't need to be a rocket scientist to set this up, Freeola helps you step-by-step.
Susan

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.