| | |
how to run perl -cgi scripts
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 7
Reputation:
Solved Threads: 0
i have got xampp1.6.8
when i run this program in localhost
#!"C:\xampp\perl\bin\perl.exe"
print "Content-type: text/html\n\n";
print '<html>';
print '<head>';
print '<meta name="author" content="Kay Vogelgesang">';
print '<link href="/xampp/xampp.css" rel="stylesheet" type="text/css">';
print '</head>';
print "<body> <p><h1>Sairam with MiniPerl</h1>";
print "CGI with MiniPerl is ready ...</body></html>";
it runs
but when it contains perl scripts it does not run as given below
#!"c:\xampp\perl\bin\perl.exe"
print "Content-type: text/plain","\n\n";
print "Welcome to Shishir's WWW Server!", "\n";
$remote_host = $ENV{'REMOTE_HOST'};
print "You are visiting from ", $remote_host, ". ";
$uptime = `/usr/ucb/uptime` ;
($load_average) = ($uptime =~ /average: ([^,]*)/);
print "The load average on this machine is: ", $load_average, ".", "\n";
print "Happy navigating!", "\n";
exit (0);
when i run this program in localhost
#!"C:\xampp\perl\bin\perl.exe"
print "Content-type: text/html\n\n";
print '<html>';
print '<head>';
print '<meta name="author" content="Kay Vogelgesang">';
print '<link href="/xampp/xampp.css" rel="stylesheet" type="text/css">';
print '</head>';
print "<body> <p><h1>Sairam with MiniPerl</h1>";
print "CGI with MiniPerl is ready ...</body></html>";
it runs
but when it contains perl scripts it does not run as given below
#!"c:\xampp\perl\bin\perl.exe"
print "Content-type: text/plain","\n\n";
print "Welcome to Shishir's WWW Server!", "\n";
$remote_host = $ENV{'REMOTE_HOST'};
print "You are visiting from ", $remote_host, ". ";
$uptime = `/usr/ucb/uptime` ;
($load_average) = ($uptime =~ /average: ([^,]*)/);
print "The load average on this machine is: ", $load_average, ".", "\n";
print "Happy navigating!", "\n";
exit (0);
as far as I know there should be no quotes on the shebang line:
#!c:\xampp\perl\bin\perl.exe
but you're better off using forward slashes, which Windows fully supports:
#!c:/xampp/perl/bin/perl.exe
backslashes in perl code create escape sequences, not on the shebang line which is a special line in a perl program, but its a good habit to use forward slashes in file/directory paths whenever possible to avoid the problem intirely. Note that DOS does not support forward slashes so if you ever do something in DOS you will have to use backslahes in directory paths.
#!c:\xampp\perl\bin\perl.exe
but you're better off using forward slashes, which Windows fully supports:
#!c:/xampp/perl/bin/perl.exe
backslashes in perl code create escape sequences, not on the shebang line which is a special line in a perl program, but its a good habit to use forward slashes in file/directory paths whenever possible to avoid the problem intirely. Note that DOS does not support forward slashes so if you ever do something in DOS you will have to use backslahes in directory paths.
![]() |
Similar Threads
- Internal Server Error (Perl)
- CGI, Tomcat, Perl, not compiling Perl code? (Perl)
- hi Any one can HELP For the learning perl (Perl)
- Serving up html using cgi-perl (HTML and CSS)
- Recommended Web Hosts (Web Hosting Deals)
- Having a problem trying to install CGI::Session on Mac OS X (Perl)
- another newbie with alot of redhat and apache server Q'S (Linux Servers and Apache)
Other Threads in the Perl Forum
- Previous Thread: Where do I start?
- Next Thread: explain this error
| Thread Tools | Search this Thread |
Tag cloud for Perl





