From http://blog.taragana.com/index.php/archive/running-php-5x-on-windows-using-tomcat-4x-or-5x/
What it solves:
Using php 5.x on Tomcat 4.x or 5.x
Enabling php only in one web application, instead of globally.
The simplest possible configuration is described. The descriptions are terse assuming your intelligence.
We will assume php will be installed in c:\ drive. Substitute with drive letter of your choice. Instructions
Download latest php 5.x zip file.
I used http://www.php.net/get/php-5.0.2-Win32.zip/from/a/mirror .
Download latest Collection of PECL modules. I used http://www.php.net/get/pecl-5.0.2-Win32.zip/from/a/mirror .
Unzip php 5.x zip file anywhere, normally c:\php
Copy php.ini-dist, in c:\php, as php.ini
Uncomment the line (remove semi-colon at the beginning) in php.ini: ;extension=php_java.dll
Extract php5servlet.dll from pecl zip file to c:\php (Uncheck "Use Folder Names" in WinZip).
Ensure that the file is actually present in c:\php
Install Tomcat and create a directory under webapps. Lets say it is named fun.
Create WEB-INF directory under fun
Create lib directory under WEB-INF
Create web.xml under WEB-INF with the following contents:
Extract php5srvlt.jar and extract/unjar (jar xvf …) it under c:\
Modify both the files reflect.properties and servlet.properties to change the line library=phpsrvlt to library=php5servlet and save them. This indicates the file name of the dll file which is loaded by the Java application to serve the requests. In my version the name of the dll was php5servlet.dll. Your mileage may vary. This has no connection with the name of the jar file which can be anything.
Re-create the jar file
Copy the jar file to WEB-INF\lib directory created earlier
Add c:\php to your System or User Path in Windows enironment (Hint: Right-click and select Properties from My Computer)
Create a file test.php under fun with the following code:
<?php phpinfo(); ?>
Start Tomcat (Go to [Tomcat installation directory]\bin and type Tomcat).
Open your browser and go to http://localhost:8080/fun/test.php
Ensure that there are no errors displayed. Instead you get an informative screen with php version information and whole lot of details