Windows PC Related CGI Questions

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
       These questions pertain to ActiveState Perl running on Windows XP and
Vista PCs.

       I checked the Perl FAQ and some other sources but did not see this
subject clearly discussed.

       A clear and easily located discussion of this subject matter might be
of interest to a number of computer users.

Background Information:  A Perl CGI bulletin board program has been written
for me by a Perl developer for use on a Web server.  I am expecting that it
will run as is.  However, if possible, to make future program development
efforts easier I would also like to run that program on my PCs that have
Windows XP or Vista and ActiveState Perl running on them.  And the original
program developer and another Web site developer that I talked with do not
know how to do that.

Q:  Is it possible to run a CGI program like that on a Windows system?

---  Does a Perl CGI module need to be downloaded first and linked with

The first two lines of code look like this:

use CGI qw (:all);

       It is my understanding that on the Internet server computer, that
first line of code tells the program where it can locate the Perl compiler.
Is it necessary to change that line of code so the program will run on my
Windows PCs?  On my system Perl is in the C:\Perl\ directory.

       Should I expect that there might be other types of code changes that
will need to be made with this type of application?  I am guessing that the
Internet server computer is running Perl programs using Unix for its
operating system.

Re: Windows PC Related CGI Questions

On 28.01.2011 11:53, E.D.G. wrote:
Quoted text here. Click to load it


No, it is a core module and thus already included in ActiveState Perl.

Quoted text here. Click to load it

Windows ignores such lines. Windows just looks at the filename and
determines the program to execute these files from the registry.

However, your Webserver might read this line. If you are using Apache,
look for ScriptInterpreterSource. Set it to registry and Apache will
ignore the #! line.


Re: Windows PC Related CGI Questions

On Jan 28, 10:06=A0pm, Wolf Behrenhoff
Quoted text here. Click to load it

There was a time, iirc, when Apache required that the shebang line
should reflect the location of perl on Windows - ie, in this
particular case:


Quoted text here. Click to load it

That's an alternative I was unaware of. (Admittedly, it has been quite
a few years since I've dabbled with Apache and CGI on Windows ... or
anywhere else, for that matter.)
Is that guaranteed to make perl locatable ? ... even if I've installed
perl in such a way that the registry has not been modified ?


Re: Windows PC Related CGI Questions

On 28.01.2011 12:34, sisyphus wrote:
Quoted text here. Click to load it

Yes, but that is Apache, not Windows. Windows does not know anything
about the #! lines. Other web servers might have different ways of
determining the path to the interpreter.

Quoted text here. Click to load it

If you have installed Perl and did not (let the installer/manually) add
any of the relevant registry keys, then Apache of course cannot find
Perl (how should it be able to?).
By default, Apache has ScriptInterpreterSource=script, i.e. apache looks
at the #! line and thus requires #!C:/path/to/perl.

More here:

Re: Windows PC Related CGI Questions

Quoted text here. Click to load it

Of course - assuming said system is running a web server.

Quoted text here. Click to load it

No, has been part of core Perl for a long time.

Quoted text here. Click to load it

That's a Unix thing, nothing to do with the internet.

Quoted text here. Click to load it

No, on Windows the usual convention based on filename extension is
respected. ActiveState's installer associates the .pl extension with
the Perl interpreter.


Sherm Pendley
Cocoa Developer

Re: Windows PC Related CGI Questions

Quoted text here. Click to load it

This is easy to do, once you've been through it several times, but
expect to get an education (which may be somewhat painful) the first
several times through.

Caution: this probably won't be an issue, because it's extremely
likely that you will be using mod_perl (with Apache) and won't even
know that there are other ways to do it. However, mod_perl isn't the
only alternative, so just be aware that you might have to make
adjustments in this area.

You can do this easily on any Windows machine, in three steps: (1) get
Apache running, (2) get Perl running, and (3) get a database running,
which most likely will be MySQL, although it isn't necessarily the

(1) Download and install the Apache binary. Configure your hpptd.conf
to run CGI. Start your httpd and see if you can access the test web
page at http://localhost:80,.

(2) Download and install the Perl binary from ActiveState. Write and
run your hello_world.plx script, then using CGI write a script that
emits a Hello World web page.

(3) Download and install your database, create a test database,
populate it, and see if you can query it.

Once you have done these three things, you should be able to write a
Perl script using CGI and DBI that accepts form parameters from a web
page, queries your database, and displays the results of the query on
a web page. As I said, all this is pretty easy, once you've been
through it several times.

A good, easy, and thorough introduction is 'MySQL and Perl for the
Web' by Paul Dubois, which you can get used on Amazon for less that
$10.00. None of the software costs anything, except Windows of course.


Re: Windows PC Related CGI Questions

       I have had the ActiveState version of Perl running for years.  And
one of my Perl .pl programs is now about 8000 lines of code long.  However,
most of the programs you mentioned I have never heard of before.  This
appears to be a totally new aspect of the Perl programming process.

So, to get started,

       With ActiveState Perl I am using their PPM program to identify and
link modules.  A CGI module is installed and running.

Q:  Should one of the available Apache modules be installed?  Or should the
separate Apache Web server program be downloaded and installed?

Q:  If a Perl Apache module can or should be used, which would be the
correct one to download?  I looked at the list of available modules and
there must be dozens and dozens of them.

Q:  It appears that mod_perl is a version of Perl that is different than the
ActiveState version.  Is that correct?  And if so, does that different
version need to be installed?

Re: Windows PC Related CGI Questions

Quoted text here. Click to load it

You should also have DBI. You also probably have a DBD for MySQL,
almost certainly for ODBC if you choose to go that route.

Quoted text here. Click to load it

Get Apache from, the Windows binary, and install it. As I
recall, you have the option to install it as a Windows service, but
it's been a while. Anyway, start the server -- there should be
something in your 'All Programs' that will allow you to start,
restart, and stop your Apache server. Once you start it, open a
browser and go to and you should see the Apache test page.

Finguring out how to ser CGI through Apache will take several hours of
work, but you need to go through the process.

Quoted text here. Click to load it

mod_perl is an Apache(!) module. I've never had to fool with it
because it's always worked. Read up on (ead'old fashioned' CGI,
FastCGI, and mod_perl and you'll see what I'm talking about.

Quoted text here. Click to load it

See above. mod_perl runs Perl IN Apache, it doesn't have anything to
do with Perl but how Apache communicates with the Perl process.

Get the book I mentioned. It's cheap and helpful.


Re: Windows PC Related CGI Questions

Again, thanks for the comments.

       This appears to be a process that is not going to be especially
complex.  The user simply needs to know what steps to take.  And as I
mentioned in my original posting, it might be helpful to Perl users to have
detailed instruction lists available in the FAQ for Perl for getting things
like that organized.

       There are many other topics that could benefit from those types of
"cookbook" lists of instructions.  For example, part of this bulletin board
program development project involves including code in the program that will
allow it to automatically visit some Web site and download, store, and
process the latest data, weather information for example.  The documentation
for using code for doing that was correct.  However, it wouldn't work.  And
after doing a fair amount of checking various things I discovered that the
problem was that my computer's virus software was blocking Perl when it
tried to visit Web sites.  And there were no error messages indicating that
this was what was happening.  So, information regarding the need to watch
for things like that in the Perl code instructions would be helpful.

Re: Windows PC Related CGI Questions

Quoted text here. Click to load it

       That time estimate was actually about right.  However, that was
largely because I had some additional help with this as I said in another
post.  Without that assistance I think that it would have taken quite a bit

In any case, by whatever means, the effort was a success!

Thanks again for your recommendations that provided a good starting point.

Re: Windows PC Related CGI Questions

Thanks for all of the comments.

       This is going to take a while.  I have never heard of most of the
terminology that people used in their responses probably because I am not a
professional programmer.  However, during the past five years or so I have
gotten through so many of the different aspects of using Perl that this one
should be manageable.

       It took me almost two years of trying different things before I was
finally able to determine how to create .exe files from Perl .pl programs.
That effort by itself must have involved identifying and then linking
perhaps a dozen different modules with Perl.

       My CGI module appears to be working.  HTML code is being generated
but is simply being dumped off into space.  It appears that I need to learn
how to get some Web server software (Apache or whatever) running on my
Windows PC.

Re: Windows PC Related CGI Questions

Its time to put another Perl related project in the "Success" bin!!!

       A kind soul who saw some of my posts contacted me and explained that
the XAMPP program works quite well for CGI applications on a Windows PC.  It
might be described as a highly enhanced version of the Apache program.

       I downloaded the normal installer package (about 66 megabytes) and
then told it to install.

       Even on a fairly fast dual core Windows Vista PC with 4 gigabytes of
memory it took a while.  But it installed without any problems and is now
running.  And, it works.

       It contains all of the needed files for running Perl CGI programs
etc. including its own copy of Perl that is stored in one of its
subdirectories.  So, a CGI .pl program used by this Web server program has
to have its first line modified with the correct address for the Perl
compiler.  That is easy to do.

       Then the user has to determine where the .pl programs need to be
stored and how to get them running.  The Web site instructions for the
program contain all of the needed information.  However, I feel that they
could be a little more detailed and clearer for those of us who are working
at the intermediate Perl programming level and have little or no CGI
experience.  It took me several hours to finally learn how to get everything
to work.

       The first version of my new Perl language Internet Bulletin Board
program is now up and running at one of my Web sites and also running on my
Windows Vista PC.

       So, its time to put another Perl related project in the "Success"
bin.  That effort got done a lot sooner and with much less time and energy
than I expected considering the complexity of the subject matter!

       Thanks again to all of the Perl Newsgroup posters for their
recommendations and advice.

Site Timeline