|
|
|
|
FastCGI and Perl
So FastCGI
is the best version of CGI you can use, that's all well
and good, but how do you use it with the best scripting
language in the world, Perl!
FastCGI with Perl on Apache
comming soon.
FastCGI with Perl on IIS 5.1,
6
First follow the steps to install and configure
Perl with IIS. Now that Microsoft has launched their own FastCGI module,
things should be easy... and they are... kind of... well they are now thanks
to Lyle Hopkins (author of this site) who has released the Perl module FCGI::IIS.
This allows you to use FastCGI with Perl in the same manor it works with
PHP. Here are the steps to download the module and configure it with your
server.
- Open a command prompt Start->Command Prompt.
- Type "ppm install FCGI". Wait for it to finish installing. Then:-
- Type "ppm install http://www.cosmicscripts.com/modules/perl/FCGI-IIS.ppd".
- Closed the command prompt.
- Open 'Internet Information Services Manager'.
- Expand your servers name.
- Right click on "Websites" then select "Properties".
- Click the "Home Directory".
- Click the "Configuration" button.
- Under the "Mappings" tab click the "Add..." button.
- In the Executable section add "C:\Windows\system32\inetsrv\fcgiext.dll"
(maybe "C:\Winnt\system32\inetsrv\fcgiext.dll", depends on your
setup).
- In the Extention section add ".fcgi".
- Click "Ok", click "Ok", and yet again click "Ok".
- Now open a text editor such as notepad (Start->Accessories->Note Pad).
- Now open "C:\Windows\system32\inetsrv\fcgiext.ini" (maybe "C:\Winnt\system32\inetsrv\fcgiext.ini",
depends on your setup).
- The bottom of this file contains:-
[Types]
- Under [Types] you already have some configuration. Do not delete what you
have already, you need to add bits to get Perl working. What we have is this:-
[Types]
php=c:\php\php-cgi.exe
fcgi=c:\perl\bin\perl.exe
[c:\php\php-cgi.exe]
QueueLength=999
MaxInstances=20
InstanceMaxRequests=500
[c:\perl\bin\perl.exe]
Arguments="-MFCGI::IIS=test"
QueueLength=999
MaxInstances=20
InstanceMaxRequests=500
- Update your fcgiext.ini file as needed.
- Go back to Internet Information Services manager.
- Stop and start your website.
- Select "Application Pools", stop and start the DefaultAppPool
- That should be it, upload a perl script to wwwroot, rename it's extension
to .fcgi and try it. Here is an example test fcgi
script (save the script as hello.fcgi without the .txt).
- No matter what script you try, your output should be something like:-
1
Mode:test
Script: c:\inetpub\wwwroot\hello.fcgi
- This is because the FCGI::IIS module is in test mode. Each time you click
refresh the number should go up by one. So if you click refresh 9 more times,
it should output:-
10
Mode:test
Script: c:\inetpub\wwwroot\hello.fcgi
- This shows that the FastCGI perl module is working properly. To get it
to work for any script, you need to go back and edit fcgiext.ini, and change
the line:-
Arguments="-MFCGI::IIS=test"
to:-
Arguments="-MFCGI::IIS=do"
- Again you'll need to stop and start the DefaultAppPool.
- Now you should find the output is what you expected, if you are running
our test script it's:-
Hello from IIS FastCGI
- Now there is one more feature of the FCGI::IIS module your probably want
to use at some point.
- What is you try your script and it doesn't work? Use the "eval" mode. Change
the arguments line to:-
Arguments="-MFCGI::IIS=eval"
- The eval mode allow you to trap errors, and should let you know why your
script isn't working.
FastCGI with Perl on IIS 7
Comming soon
|
|
|
|
|
|
|
|
|
|
Want
the latest news?
Then why not sign
up for our newsletter? Be notified immediately about new
products, upgrades, sales, discounts, bug fixes, site updates
and more. |
|
|
|
|
|