Database Reference
In-Depth Information
You may also have to add a LoadModule directive for php .
With PHP enabled, you can install a PHP script myscript.php under htdocs (the Apache
document root directory). The URL for invoking the script becomes:
http://localhost/myscript.php
If PHP runs as an external standalone program, you must tell Apache where to find it.
For example, if you run Windows and you have PHP installed as C:\Php\php.exe , put
the following lines in httpd.conf (note the use of forward slashes in the pathnames rather
than backslashes):
ScriptAlias /php/ "C:/Php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php /php/php.exe
For purposes of showing URLs in examples, I'll assume that Perl, Ruby, and Python
scripts are in your cgi-bin directory, and that PHP scripts are in the mcb directory of
your document tree, identified by the .php extension. That means the URLs for scripts
in these languages look like this:
http://localhost/cgi-bin/myscript.pl
http://localhost/cgi-bin/myscript.rb
http://localhost/cgi-bin/myscript.py
http://localhost/mcb/myscript.php
Adjust the pathnames as necessary for your own system.
If you plan to use a similar setup, make sure to have a cgi-bin directory that Apache
knows about, and an mcb directory under your Apache document root. Then, to deploy
Perl, Ruby, or Python web scripts, install them in the cgi-bin directory. To deploy PHP
scripts, install them in the mcb directory.
Some of the scripts use modules or library files that are specific to this topic. If you have
these files installed in a library directory that your language processors search by default,
they should be found automatically. Otherwise, you must indicate where the files are
located. An easy way to do this is by using SetEnv directives in your httpd.conf file to
set environment variables that can be seen by your scripts when Apache invokes them.
(To use the SetEnv directive, the mod_env Apache module must be enabled.) For ex‐
ample, if you install library files in /usr/local/lib/mcb , the following directives enable
Perl, Ruby, and Python scripts to find them:
SetEnv PERL5LIB /usr/local/lib/mcb
SetEnv RUBYLIB /usr/local/lib/mcb
SetEnv PYTHONPATH /usr/local/lib/mcb
For PHP, add /usr/local/lib/mcb to the value of include_path in your php.ini configu‐
ration file.
Search WWH ::




Custom Search