Installing Perl on a Win32 installation of Apache is trivial. Just a few short years ago (roughly the year 2000) most commercial website still ran large amounts of Perl code. Several open-source projects like BugZilla still rely on this powerful scripting language.
Here’s a few simple steps and advice to consider when the need comes to add this feature to your installation.
- Download Perl for Win32 – ActiveState Perl is the standard distribution to use, and installation is a snap.URL = http://www.activestate.com/Products/ActivePerl/a) Get the MSI file version as it’s executable (the AS version is a ZIP file for manual installs)
b) The default path it chooses is “C:\Perl”, I advise that you use “c:\usr” instead as it makes it easier to port programs to and from UNIX/LINUX.
c) The MSI installer takes care of the PATH file settings, so you should have no other work for installation.
- Modify the Apache httpd.conf file to enable (uncomment or add the following lines).
AddHandler cgi-script .cgi
AddHandler cgi-script .pl - Restart Windows to ensure that the new configuration is available to the operating system.
- Test your install…a) Create a new file on the server named /cgi-bin/hello.pl with the following content:
#!/usr/bin/perl
print “Content-type:text/html\n\n”;
print “hello world”;b) Start (or restart) the Apache service.
c) Access the file in the browser, example:
URL = http://localhost/cgi-bin/hello.pl
d) If everything works, you should see the words “hello world”, otherwise, if you see the source code or ‘500 Server Error’ then the config has a problem.
Happy Scripting.