How to run perl script on ampps

From AMPPS Wiki
Jump to: navigation, search
  • To run Perl Scripts on AMPPS server, add Shebang line in the file and place it in cgi-bin directory.
  • Here is a example of Perl script to print Hello word:
  • Go to /path/to/Ampps/www/cgi-bin directory and create one test.pl file.
  • Add following Shebang line at the beginning of the file.

For Linux:

 #!/usr/local/ampps/perl/bin/perl

For MACOS:

 #!/Applications/AMPPS/perl/bin/perl

For Windows:

 #!\path\to\Ampps\perl\bin\perl.exe

Note: In above line add actual path to Ampps directory instead of \path\to\Ampps.

  • Now print hello word.
 
print “Content-Type: text/html\n\n”;
print “Hello”;
  • Save it, restart Apache.
  • Now access your file on browser localhost/cgi-bin/test.pl