note 36497 deleted from install.apache2 by sniper
| From: | sniper@php.net | Date: | Sat, 29 Nov 2003 12:29:35 +0000 |
| Subject: | note 36497 deleted from install.apache2 by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-61114@lists.php.net to get a copy of this message | ||
Note Submitter: The Unacoder
----
For PHP and Apache 2.0 on Windows, CGI (not module) flavour, here's another example of the
lines you must add to Apache's httpd.conf:
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php-exe-location/php.exe"
ScriptAlias /php-exe-location/ "c:/Program Files/php-4.3.3-Win32/"
These allow you to have PHP installed in "c:\Program Files" (where it belongs so it
doesn't clutter up c:\). Also, for explanation purposes only, I've re-ordered the
statements into the order in which Apache uses them to process an incoming request. Corresponding
to the lines above, here's what happens to an incoming request for http://www.mySite.com/myPHP/foo.php:
(1) the "AddType" directive means all requests ending in ".php" will be MIME
type "application/x-httpd-php"
(2) the "Action" directive means anything of MIME type "application/x-httpd-php"
will get acted upon by something with URL (not file system path) of
"/php-exe-location/php.exe"
(3) the "ScriptAlias" directive means any URL with "/php-exe-location/" will get
that mapped to "c:/Program Files/php-4.3.3-Win32/" in the file system and will be treated
as a script.
(4) "c:\Program Files\php-4.3.3-Win32\php.exe" (Apache will switch forward-slashes to
back-slashes) will get executed. php.exe must then examine the original HTTP request (available via
environment variables as per CGI spec) to see that it is "myPHP/foo.php" it's
supposed to execute.