Page 1 of 1

How to run CGI on XAMPP?

PostPosted: 09. August 2008 08:11
by benza
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.

PostPosted: 09. August 2008 11:09
by Nobbie
Which kind of CGI Scripts? Did you adapt the first line (the shebang line)?

How to run CGI on XAMPP?

PostPosted: 10. August 2008 22:32
by ukprotect
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

PostPosted: 12. August 2008 21:50
by benza
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

How to run CGI on XAMPP?

PostPosted: 17. August 2008 19:10
by ukprotect
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