Perhaps this will save someone the hours that it cost me to figure it out how to go from a CGI version of PHP to a module version on Apache 2 for Win2K:
I've had a CGI versions of PHP 4 through several releases of Apache and the setup for that is really easy (assuming they both individually work).
- Review php.ini (engine = On, et. al)
- Move php4ts.dll in appropriate windows subdirectory (for me it's System32).
The remaining 4 items are changes/additions to Apache's httpd.conf file:
2. (not required) Put index.php as the first argument to DirectoryIndex so Apache will automatically pick up index.php files
Now add the following 3 lines:
3. AddType application/x-httpd-php .php
4. Action application/x-httpd-php "/php4/php.exe"
5. ScriptAlias /php4/ "c:/winapps/php/4.2/sapi/"
3 is so Apache will know .php files are special. 4 is so Apache will know what special program to run when it realizes it has a special (.php) file. 5 is so that Apache will know what directory that special program (php.exe) lives in.
To go from the CGI to the Module version should be even simpler, right? But there is a HUGE gotcha. It's one of those You can't get there from here syndromes if you are using Apache 2.0.28 (or earlier, I presume). I needed to upgrade to 2.0.35 so that the php (4.2) provided apache2filter.dll file that is necessary would work with Apache2.
So the final steps are as follows:
Do steps 1-3 as written above.
If you are upgrading, not installing, then back out steps 4 and 5 from above.
4) Add a line to the httpd.conf file:
LoadModule php4_module c:/winapps/php/4.2/experimental/apache2filter.dll
NOTE that this is not the php4apache.dll file of yore in the sapi directory (which I presume would work if you were doing this with Apache 1.3.x)
Happy Serving,
Csaba Gabor