In theory: very easy.
This article is a short summary about running Active FoxPro Pages 3.0 under Apache 2.0.x for Windows. Please backup your central configuration file - httpd.conf - before realizing the changes - just in case of emergency.
First, we need some 'magic' configuration tools:
- a Command Prompt (Start - Run - 'cmd' - OK) and
- a simple ASCII editor like Notepad
Change to the %Apache2%\bin directory with the command
cd
and test your current Web server configuration - just for fun - with the following statement
C:\Program Files\Apache2\bin>apache -t
Syntax OK
Fine, Apache is still running - *g*.
Now, we have to change the configuration of the Web server. Our goal will be
- loading module mod_isapi.so
- creating an alias directory for AFP3.DLL
- loading AFP3.DLL as an ISAPI extension of Apache
- setting a new handler for the file extension .afp and
- forcing that handler to run the correct DLL
As an advice, it's recommended to check the syntax of httpd.conf after every single configuration step. That should reduce the circumstances to find any error - if something fails.
Okay, enough bubbled. To increase the pace a little bit and to offer more transparency to you, I've prepared something...
Excerpt from an httpd.conf with Active FoxPro Pages:
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "C:/Program Files/Apache2"
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
# some other prefered modules...
#
# Important for using Active FoxPro Pages
#
LoadModule isapi_module modules/mod_isapi.so
### Section 2: 'Main' server configuration
#
# ...
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options ExecCGI
AllowOverride None
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.afp default.afp main.afp index.html index.html.var
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# other aliases...
#
# ScriptAlias for using Active FoxPro Pages
#
<IfModule mod_isapi.c>
ScriptAlias /afp3 "C:/Program Files/AFP3/"
<Directory "C:/Program Files/AFP3/">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow From all
</Directory>
ISAPICacheFile "C:/Program Files/AFP3/AFP3.dll"
ISAPIAppendLogToErrors on
</IfModule>
#
# ...more directives
#
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use AFP documents
#
Addhandler isapi-isa .dll
Action afp-script /afp3/AFP3.dll
AddHandler afp-script .afp .fxp .prg .dbc .dbf
# if normal HTML/WML/XML pages should be parsed through AFP engine...
AddHandler afp-script .html .wml .xml
AddType application/x-httpd-afp .afp .fxp
AddType application/x-httpd-afp .afp3
AddType application/x-httpd-afp .html
#
# many other configuration directives for Apache...
#
Please remind that this is only an excerpt of httpd.conf and not a useable configuration file. Please integrate the AFP related parts into your own configuration file.
But don't hazzle, the complete configuration file is available as download.
Maybe one gotcha, the file uses the German version of paths in MS Windows ('Programme' instead of 'Program Files'). Just search and replace and it should be okay. So, check the whole file and change the values according to your system.
At the end of this article I ask you a favor - that you should know the directives of the Apache Web server a bit or at least to look at the documentation. It's available at the Web site of the Apache Group.
Enjoy the AFP-FAQ, JoKi