Kiko has asked for the wisdom of the Perl Monks concerning the following question:

I use IIS5 as my webserver and i run all my Perl Scripts from it. But now i need to do a project for class in which i'm required to use php,mysql, and apache. I got php,mysql, and apache to work, but now i need to configure apache to be able to run my Perl Scripts. I know that some of you use both Perl and php and are probably using Apache as your webserver. Any help that you guys can provide will be greatly appreciated. Thanks, Kiko

Replies are listed 'Best First'.
Re: Perl, PHP, and Apache
by Asim (Hermit) on Apr 13, 2001 at 15:10 UTC

    Apache comes pretty much pre-configured witht he ability to run Perl scripts that are 1) In it's cgi-bin directory, and 2)have the #! on the first line pointing to where your perl executable is. This is it's standard and recommended configuration. If you have another directory you want to run scripts from, you'll need to configure Apache to use it, likewise, there's an option to have Apache (on Win32 platforms, which is what I'm assuming you're using here) use the Registry/file extention setting insead of the #! setting -- but I don't necessarly recommend it.

    So, for you, all you should need to do is install the latest Win32-based version of Apache, then Perl precompiled for Win32. When you install Perl, make a note of what directory Perl is installed into, then, after the install, go into it, then go into the bin\ directory, and find the file Perl.exe. Then go into where Apache is installed, find the cgi-bin directory, then find a file printenv.pl. Open that file in a text editor, and chage the top line as described above. Forinstance, if the location of your Perl executable is c:\Perl\bin\Perl.exe, you'd put #!c:\perl\bin\perl.exe as the top line.

    Run printenv.pl in your web browser like any other cgi script, and be amazed. That's the basics, and I HIGHLY recommend you check out Apache's own documetation on the subject -- it's clearly written, and will guide you well if you have patience with it. Good luck.

    ----Asim, known to some as Woodrow.

      The problem that i'm having is that i downloaded php,apache, and mysql pre-compiled(or configured) from Firepages. And it seems to be that they configured apache to work only for php. I tried what you told me but it still doesn't work.

        Without knowing what they've configured it to do, I went to the Firepages site. Where's their documetation? Without knowing more about what you have there (what error message are you getting?), I'd have to recommend you take another look at Apache's docs on configuring for CGI. I know it sounds like a cop out, but that's how I did it after I broke my first Apache install. I'd bet that you just have to add pl to AddHandler.

        ----Asim, known to some as Woodrow.

Re: Perl, PHP, and Apache
by Beatnik (Parson) on Apr 13, 2001 at 15:14 UTC