Page 1 of 1

How to run CGI on XAMPP?

PostPosted: 09. August 2008 08:11
by benza

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?


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


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

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


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: ... list.mhtml

PostPosted: 12. August 2008 21:50
by benza

This is an Amazon products feed, more detail on :
Working sample of the script: ... ndex=Books

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

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:
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:

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

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


If the script interpreter provided by xampp does not work for your cgi scripts, then try activeperl