Gossamer Forum
Home : General : Perl Programming :

Setting up my home computer

Quote Reply
Setting up my home computer
I think I asked this once before, but here goes again.

How, in a step-by-step, for dummies, as if I were a three-year-old sort of way, can I run cgi scripts on my home computer without having up upload them to the server and test them there? I must be unclear on some basic concept that I don't even know exists to be unclear on, 'cause I just don't get it.

Whoever even attempts to explain this will have my undying gratitude.


------------------
JPD
Quote Reply
Re: Setting up my home computer In reply to
Okay, you need to download 2 programs. You can get ActivePerl from activestate.com/ActivePerl and Apache build 1.3.3 from apache.org/dist -- the file called apache_1_3_3.exe

Once you have those installed, start Apache. In your CGI scripts, reference your perl directory -- something like : #!c:\perl\bin\perl.exe

Put you cgi files in directories off your cgi-bin (under the Apache/cgi-bin)just like on a server.

Now you should be set. Hope that helps.


------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Setting up my home computer In reply to
Thank you!! I'll give it a try and let you know how it works out.

I do really appreciate the help.



------------------
JPD
Quote Reply
Re: Setting up my home computer In reply to
Activestate does a great job on it's documentation! Take a look at:

http://www.activestate.com/...2/perlwin32faq6.html

For setting up perl on a variety of windows web server.

Cheers,

Alex
Quote Reply
Re: Setting up my home computer In reply to
Hi jdulberg,
I followed the steps but didnt get it work.
When i opened the server and try to run a script, it just asked me whether to save it or to open it.

I am using windows95 with apache_1_3_3.exe for win32 and i ran the scritp at my server (http://localhost/cgi-bin/scriptname)

Any suggestion?
Quote Reply
Re: Setting up my home computer In reply to
Make sure that in your Apache configuration files, that you configure to allow CGI running. Here is a brief rundown on how to do that:

In your Apache config directory (on my system it is c:\Program Files\Apache Group\Apache\conf), you need to edit the following files: access.conf and srm.conf. In access.conf, you should see a line at about row 42, which says something like:
Code:
Options Indexes ....
Change this line to read:
Code:
Options Indexes ExecCGI Includes
This not only allows CGI execution, it will also allow includes to be used.

Next, in SRM.CONF, first off, we can setup a script alias. Mine says the following, you can change it to whatever you want, just make sure the directory exists:
Code:
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
Anything placed in this directory can be run as a CGI. If you want more open controls, you can allow any file named *.cgi to run as a CGI. To do this, edit SRM.CONF, and under the area for the ScriptAlias, you will see a line similar to:
Code:
# To use CGI scripts:
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
As you can see, I created a handler for .cgi and .pl files. Either one can be run as a CGI. On a default SRM.CONF file, these items may be commented with a "#", just remove, or if you wish, keep the comment and add the additional lines underneath.

Some important notes: 1) These conf files are not PERL, don't put Perl constructs in them or close lines with semi-colons. 2) The conf files are very sensitive to errors and badly worded statements. If after changing your conf file you find the server will not start, you messed something up. ALWAYS keep a backup of the distribution files and restore if you get an error. 3) If you want to add includes, you need to add a handler for them. An example, this is inserted in SRM.CONF under the CGI directives:
Code:
# To use server-parsed HTML files
AddType text/html .shtml
AddHandler server-parsed .shtml
This allows files ending in .shtml to be parsed for includes. You could also allow .html and .htm files by the same concepts.

Hope this helps.


------------------
Fred Hirsch
Web Consultant & Programmer
Quote Reply
Re: Setting up my home computer In reply to
Thanks all !!
I got it work. Smile
Quote Reply
Re: Setting up my home computer In reply to
Okay. I got it installed and it runs, I think. I need to make some changes, it seems to the .conf files. Apache documentation isn't the best in the world. It said I had a "src" directory where I could look for files. I don't. There was another file it said I had, which I don't.

Anyway, it did run (I used the DOS shell to start it). Then I wanted to stop it. There was a command listed in the Apache docs that it said to enter -- "kill something or other."

I copied the exact wording, but where do I enter it? The DOS shell doesn't give me a prompt and won't accept input.

And what is my server name?


------------------
JPD
Quote Reply
Re: Setting up my home computer In reply to
Deni,

Sounds to me you are trying to use UNIX docs for your Win32 install of Apache. IF you used the default install, you should find some helpful information in the following directory:

C:\Program Files\Apache Group\apache\htdocs\manual\windows.html

The rest of the regular manual can also be found in the .\manual directory.

Hope this helps.


------------------
Fred Hirsch
Web Consultant & Programmer
Quote Reply
Re: Setting up my home computer In reply to
Aha! Thank you. That should help a whole lot. Smile



------------------
JPD
Quote Reply
Re: Setting up my home computer In reply to
Can i shorten the path to perl so that i dont need to type C:\Perl\5.00502\bin\MSWin32-x86-object\perl5.00502.exe everytime i run cgi in my computer and change back to /usr/local/bin/perl everytime i upload it.

Quote Reply
Re: Setting up my home computer In reply to
The short answer is, since NT doesn't allow for the use of symbolic links, NO, you cannot shorten the path. However, to me, it looks like you have an older install of ActivePerl. When I recently downloaded, I was permitted to place perl in C:\perl\bin\perl.exe, which is a bit shorter. Problem with changing the path is you will need to either, install in a new directory, uninstall and reinstall (so that the registry is setup right), or simply edit the registry yourself (not always the best idea). You would also probably have to change some settings if you use IIS or another NT native web server.


------------------
Fred Hirsch
Web Consultant & Programmer
Quote Reply
Re: Setting up my home computer In reply to
I am trying to set up perl and apache on windows 95 and am running into a problem

When I try to run apache through the consol window it stats: "cannot determine local host name. use the server name directive to set it manually"
I used run: winipcfg to get the data and tried a couple diferent setting sfor the name directive but I keep getting the same exact line. What am I doing wrong and how should I set this up. I tried it as many ways as I could think of and nothing works. I tried using the IP, the host name, the DNS listed, etc. and no deal.

Any ideas?
Quote Reply
Re: Setting up my home computer In reply to
This indicates to me that networking may not be setup correctly on your system, or that there might be a conflict of some kind. However, you might have a work around for this. In your http.conf file, there is a line named: #ServerName new.host.name If you have changed this to something, change it back, otherwise, remove the "#" symbol, and replace new.host.name with the IP address of your computer. If you do not know this IP address, make it 127.0.0.1, and then when using the web browser, point your system to either http://localhost or http://127.0.0.1

Hope this helps,


------------------
Fred Hirsch
Web Consultant & Programmer
Quote Reply
Re: Setting up my home computer In reply to
your the man Fred!

Works perfect now, this should greatly speed up my learning process. And you will be the first one I call on for any sub contracting we need.

Now I just need to get linux up and running on my answering machine and I'll be set ... ;o) lol
Quote Reply
Re: Setting up my home computer In reply to
Fred,

Thanks for the help!

I ordered all those books you recommended and
am looking forward to their arrival.

Chunk of change but I think it's worth every penny.

Dave
Quote Reply
Re: Setting up my home computer In reply to
I have Apache working fin now except for perl

I have installed activeperl and tested it in a consul using the test scripts they provide and it works. The problem I am having is this:
I read much of the documentation for apache and the docs regarding apache included with activeperl and followed them to the letter. I have included all configuration lines and I still receive this problem.

When I try and access a script for example:
http://127.0.0.1/cgi-bin/test.cgi
I keep getting this error:
"The requested URL /cgi-bin/test.cgi was not found on this server."

I can not find the problem. I have checked and placed the folowing in httpd.cfg

Options Indexes FollowSymLinks Includes ExecCGI

ScriptAlias /cgi-bin/ "E:/Apache Group/Apache/cgi-bin/"

#
# "E:/Apache Group/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "E:/Apache Group/Apache/cgi-bin">
AllowOverride None
Options None
</Directory>

I am stumped now.

Any ideas what I am doing wrong?

Dave
Quote Reply
Re: Setting up my home computer In reply to
Fred

I know that the srm, access, and httpd files are seperate but I was just following the instructions in the access.conf file which i have pasted below.

#
# This is the default file for the AccessConfig directive in httpd.conf.
# It is processed after httpd.conf and srm.conf.
#
# To avoid confusion, it is recommended that you put all of your
# Apache server directives into the httpd.conf file and leave this
# one essentially empty.
#

I just found where they placed the directives in httpd.conf and placed the lines there.

Dave
Quote Reply
Re: Setting up my home computer In reply to
Whoops,

That line belongs in access.conf, make sure you remove it from httpd.conf. All you should have to do in access is probably uncomment those lines and make sure the path is correct. You also need to make changes in SRM.conf along the same lines. Keep in mind that Apache uses THREE config files to do its magic: httpd.conf, srm.conf, and access.conf. These files handle various aspects of the config, so do not get em confused, and don't put stuff from one config file into another.

Hope this helps.


------------------
Fred Hirsch
Web Consultant & Programmer
Quote Reply
Re: Setting up my home computer In reply to
Try http://www.jlk.net/apache/ .
It simplifies getting apache up running quite a bit.