How to run CGI on XAMPP?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to run CGI on XAMPP?

Postby benza » 09. August 2008 08:11

hello,

I am downloading a script that contain some CGI files.
I try it on live server, it's work, but when I try on localhost, it's not work.

Did I miss something?
What is exactly I am doing to run a CGI script on localhost?
Should I put it on folder cgi-bin?

thanks.
benza
 
Posts: 8
Joined: 18. July 2008 01:57

Postby Nobbie » 09. August 2008 11:09

Which kind of CGI Scripts? Did you adapt the first line (the shebang line)?
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

How to run CGI on XAMPP?

Postby ukprotect » 10. August 2008 22:32

Edit httpd.conf as follows:

1. find

<IfModule alias_module>

ScriptAlias should be directed to your scripts folder. eg.

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"

2. immediately after

</IfModule>

Add this

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride All
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
Allow from all
</Directory>

3. Save httpd.conf and close it.

4. If you are running the CGI on a windows machine, open each CGI file with a text editor eg wordpad or Notepad and make sure the first line shows the location of a Perl interpreter eg.

#!C:/Perl/bin/perl.exe or

#!C:/xampp/perl/bin/perl.exe

I have discovered that Perl for xampp does not work with some applications. If it does not then you can download a free copy from the following link:

http://www.activestate.com/Products/act ... list.mhtml
Thinking is the hardest thing there is, which is the probable reason why so few engage in it.
ukprotect
 
Posts: 11
Joined: 10. August 2008 18:28

Postby benza » 12. August 2008 21:50

Nobbie,

This is an Amazon products feed, more detail on :
http://www.mrrat.com/aws/
Working sample of the script:
http://www.mrrat.com/cgi-bin/apf4/amazo ... ndex=Books

I try to find solution on their forum, but no answer yet.

Ukprotect,
Do I need download and activePerl?
I am totally beginner about CGI and perl.
I do all your instruction on httpd.conf, restart apache, and still get the same error.

I see a cgi-bin directory on my Xampp, located on:
f:/xampp/xampp/cgi-bin
Are the files on this directory affecting apache, if all the files on cgi-bin fodler is deleted, is apache still can run a cgi script?

While the perl is lcated on other directory:
f:/xampp/xampp/perl/bin/perl.exe
benza
 
Posts: 8
Joined: 18. July 2008 01:57

How to run CGI on XAMPP?

Postby ukprotect » 17. August 2008 19:10

If you edited the code I listed above and just made alterations to suit your needs then you will be able to run CGI. Just edit to show that your CGI folder is on drive F:\ eg.

ScriptAlias /cgi-bin/ "F:/xampp/xampp/cgi-bin/"

<Directory "F:/xampp/xampp/cgi-bin">
AllowOverride All
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
Allow from all
</Directory>

Each CGI file should then be edited using notepad or wordpad so that each has the location of the script interpreter eg.

The first line of each cgi file should be

#!"f:/xampp/xampp/perl/bin/perl.exe"

If the script interpreter provided by xampp does not work for your cgi scripts, then try activeperl
Thinking is the hardest thing there is, which is the probable reason why so few engage in it.
ukprotect
 
Posts: 11
Joined: 10. August 2008 18:28


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 153 guests