Here we will explain how to set up Apache to run your scripts off-line. This section is not necessary, but you might want also to test your webpage under a real server. This might especially interest you if your internet provider uses Apache as it's server. Many internet hosting services do use Apache.

 

There are many distrubutions of apache. We recommend a distrubution that comes bundled with perl and also mod_perl. See the setting up section. We also recommend installing in a root folder like c:\apache.

 

After installation, copy your website files under the htdocs and cgi-bin folders. If you installed under c:\apache enter the following in the Options dialog under section "External server":

 

  • Access log file: c:\apache\logs\access.log
  • Error log file: c:\apache\logs\error.log
  • Document Root folder: c:\apache\htdocs
  • Aliases: /cgi-bin/=c:\apache\cgi-bin
  • Port: 80

 

icon_idea You can also import apaches httpd.conf file instead of entering the above. It's path is c:\apache\conf\httpd.conf

 

The log files are used to have a live view of them in the Log Windows

 

Apache runs by selecting "Start Apache" from the start menu. Start it (a console window - minimize it) and your web browser, and enter http://127.0.0.1 (you don't have to be on the internet). If you get a message "Go offline" press cancel. You should see the Apache's help. If not, try putting any html document named index.html in the directory c:\perl\htdocs, or c:\apache\htdocs.

 

Note that whenever CGI Scripts are to be run, apache must be loaded and working. If apache's window opens and closes very fast, it has not been loaded. Check the F.A.Q if this happens.

 

Whatever CGI script you put in directory C:\apache\cgi-bin, can be run by putting an address in your browser http://127.0.0.1/cgi-bin/test.cgi etc. A good idea is to try this also. Copy hello.cgi into the directory c:\perl\cgi-bin and enter in your browser the above address. If you get errors, something is wrong.

 

icon_exclaim IMPORTANT: To run CGI scripts in windows using Apache, you must change their first line to

 

#!C:\perl\bin\perl.exe (where you have your perl interpreter)

 

When you upload them afterwards to the server, change to

 

#!/usr/local/bin/perl (or wherever perl is at the server)

 

Optiperl can change the above automatically when uploading either when publishing your project or saving to a remote location.

 

 

Top  Previous  Next