MIDAS KnowledgebaseMIDAS Knowledgebase

How to install & configure Perl on a Windows server

This article is part two of our three part series "How to install pre-requisites needed for running a self-hosted edition of MIDAS from a Windows server".
It applies to self-hosted installations on Windows-based servers only, and outlines how to install ActivePerl on Windows. Other Windows distributions of Perl (such as Strawberry Perl) are also available.
Please note that this article is provided "as is" and is correct at time of writing. For further assistance installing/configuring Apache, please refer to the vendor's own documentation/support.
This article assumes that you've already successfully completed our previous "How to install & configure Apache on a Windows server" guide.

Contents:


Step 1 - Download ActivePerl for Windows

ActivePerl for Windows may be downloaded from ActiveState.
A free "Community Edition" is available in both 32-bit (x86) and 64-bit (x64) versions, depending upon whether your Windows server runs a 32 or 64-bit Windows operating system:

Download ActivePerl for Windows


Step 2 - Install ActivePerl

Run the ActivePerl Installer, read & accept the License Agreement, and choose the components to be installed:

Choose which ActivePerl components to install

We suggest that both "Perl" and "PPM" are selected. If in doubt, leave the default settings and click "Next".
From this dialog you can also select the location where Perl will be installed on your Windows Server. The default is "C:\Perl" (for 32-bit ActivePerl) or "C:\Perl64" (for 64-bit ActivePerl)

On the following dialog, be sure that "Add Perl to the PATH environment variable" is selected:

ActivePerl Configuration Options
...and proceed to install ActivePerl


Step 3 - Test

Once the ActivePerl installer has complete, let's test Perl to ensure that it's working correctly.
Open a standard text editor and add the following two lines:

#!C:\Perl\bin\perl.exe
print "content-type:text/html\n\nHello World!";

Save this file as "test.pl" to C:\Apache24\htdocs (or D:\Apache\htdocs, etc depending upon where you installed Apache)

If you've not added the "ScriptInterpreterSource Registry" directive to your Apache server's http.conf file (as described in the first part of this series, "How to install & configure Apache on a Windows server", then ensure that the first line of your "test.pl" file reflects the location where you chose to install ActivePerl, followed by \bin\perl.exe. If however you did set the "ScriptInterpreterSource Registry" Apache directive, then you don't need to worry about the first line of your test.pl script being correct - in fact, it can be safely omitted it all together!

Next, in your web browser, navigate to http://127.0.0.1/test.pl, and you should then see the words "Hello World!" in your browser:

Perl Hello World Test Script

...which indicates that Perl has been correctly configured!

If however, you see the entire contents of your test.pl file, then Apache didn't know how to handle your .pl file, and so instead of "executing" it, displayed its contents as plain text instead. In which case, please check Step 3B of our "How to install & configure Apache on a Windows server" guide.

If all you see if a server error when access test.pl in your browser, it's likely that either you've not correctly configured Apache to handle .pl files and/or to execute cgi scripts (please refer back to our "How to install & configure Apache on a Windows server" guide), or there's a typo in your test.pl file


Step 4 - Install Additional Modules

Once you have your test.pl script displaying "Hello World!" in your browser, it's now time to download and run our "Server Readiness" MIDAS tool. This utility will test your server setup and ensure that you have all the required Perl modules required for running MIDAS, and may be freely obtained via the MIDAS Server Requirements page.

Save the utility to the same location as your previous "test.pl" script, and then access it via your browser in the same way.

Let the Server Readiness tool run, and make note of any missing required Perl modules:

MIDAS Server Readiness Tool

ActivePerl comes with a handy "Perl Package Manager (PPM)" tool allowing you to easily install additional modules. You should be able to locate this tool via a shortcut in your Start Menu:

Open Perl Package Manager

When PPM loads, press Ctrl + 1 to view all available packages, and use the search box to locate those which the MIDAS Server Readiness tool informed you were missing, in this example, DBD::mysql:

Perl Package Manager
Right-click on the module and select "Install " to mark it for installation.

Do this for any other missing required modules, and then once you've marked all the required modules for install, press Ctrl + Enter. Accept PPM's confirmation that it's about to install modules, and then let the installation commence. It may take several seconds/minutes depending upon the number of modules you've selected. Once installation of all modules is complete, the "Status" tab at the bottom of the PPM window will indicate that installation is complete.

Re-run the MIDAS Server Readiness tool again in your browser to check that the previously missing modules have now been installed.

You might also be interested in...
» » »

← Return to Knowledgebase