Xampp Apache doesn't want to run CGI Perl scripts

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

Xampp Apache doesn't want to run CGI Perl scripts

Postby rlm1947 » 17. November 2006 22:26

I have loaded xampp on my Windows XP box, and I want to us it for development work so thatI don't have to ftp my files to the Unix server to see if they work. I guess a lot of folks do this.

I see some strange symptoms:
- when I click on the link that calls the cgi script (came from some shared scripts site on the internet) it doesn't run the script (which runs quite nicely on the Unix server). It instead gives me an error message, but not a normal error message, but rather the html code for the error message. BTW: I have the shebang line as correct as I can make it.

this is what I see in my firefox window:
- - - - - - - - - - - -
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<title>Server error!</title>
<link rev="made" href="mailto:admin@localhost" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body { color: #000000; background-color: #FFFFFF; }
a:link { color: #0000CC; }
p, address {margin-left: 3em;}
span {font-size: smaller;}

<h1>Server error!</h1>

The server encountered an internal error and was
unable to complete your request.


Error message:
<br />Premature end of script headers: index.cgi

If you think this is a server error, please contact
the <a href="mailto:admin@localhost">webmaster</a>.


<h2>Error 500</h2>
<a href="/">localhost</a><br />

<span>11/17/06 11:03:36<br />
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.1.6</span>
- - - - - - - - -

This tells me that there is some configuration setting or other that is incorrect. The comments in httpd.conf are less than helpful. Is there anywhere where there is a document with cookbook instructions on what Windows XP needs to make Apache run cgi (perl) scripts?


Posts: 1
Joined: 17. November 2006 21:32

Postby Wiedmann » 17. November 2006 23:04

AF Moderator
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Izzy » 17. November 2006 23:17

Whenever you get a server error check the server's error log. It will more than likely tell you what is giving it a pain. Check the date and time you get the error and look in the error log for the corresponding date and time entries.
Paste it here if you have problems understanding it.

The shebang line must be absolutely correct and is usually the path to the perl.exe file and must be the first line with no spaces above it.
In my case it looks like this:
Code: Select all

use CGI;

$form=new CGI;


There are cgi test scripts in the http://localhost XAMPP welcome pages located in the left menu. Try the Guest Book.
The file is located here:
xampp\htdocs\xampp\guestbook_en.cgi (or what ever your language is set to)
Open the guestbook_en.cgi in your text editor and it will also give you the correct shebang line on your system.

If you did not install to the default path did you run the setup_xampp.bat file as per the xampp\readme-en.txt file?
Posts: 3344
Joined: 25. April 2006 17:06

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 87 guests