Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am very new to CGI programming in Perl.

In order to learn it i installed xampp 2 days back. But I am unable to execute my perl code . The code goes as folows:

use CGI;
$co = new CGI;
print $co->header,
$co->start_html(title=>'CGI Example'),
$co->center($co->hi('Subhayan welcome to CGI')),

Have saved the code in a text file named : Subhayan1.cgi and kept it in the folder cgi-bin under xampp folder in C drive.

When i try to execute this through my web browser typing : "http://localhost/cgi-bin/Subhayan1.cgi" it comes up with a "Object not found page".

I checked the apache configuration file under : xampp/apache/conf/httpd.conf.

I checked the entry : ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"

It looks like pointing to the correct directory.

What is the issue here can anyone help please???

share|improve this question

migrated from stackoverflow.com Dec 10 '12 at 12:31

This question came from our site for professional and enthusiast programmers.

Did you make sure that your script is executable? chmod +x Subhayan1.cgi –  ddoxey Dec 10 '12 at 4:21
@ddoxey - does Windows use chmod? I thought it didn't. –  ghoti Dec 10 '12 at 12:31
Yes, you're right windows doesn't have chmod. But I'm pretty sure there's some equivalent. Probably right-click and selecting an executable checkbox. –  ddoxey Dec 10 '12 at 15:24

2 Answers 2

You should the webserver access/error log to see what is the real error.

Are you able to run the cgi script from windows commandline?

For Perl CGI script you should install Perl and CGI.pm.

cmd> C:/xampp/cgi-bin/Subhayan1.cgi

The output should be:

Http 1.1

If everything works fine this point you should be sure that your installed Perl version added as handler for CGI scripts in Apache.




share|improve this answer

Try the below codes..it will works fine.

use CGI;
$co = new CGI;
print $co->header,
$co->start_html('CGI Example'),
$co->center('welcome to CGI'),


use CGI;
$co = new CGI;
print $co->header;

print "
<title>CGI Example</title>
 welcome to CGI
share|improve this answer
Hello! Welcome to Super User! Mind explaining why, this works, not just how? –  Qix Feb 7 '13 at 7:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.