Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts
19
Posted on 12:35 AM by Softminer and filed under ,

1.download and unzip PHP 5 to a directory, c:\php-5.2.6-Win32
http://www.php.net/get/php-5.2.9-2-Win32.zip/from/a/mirror

2. download PECL 5.2.5 Win32 binaries.
http://museum.php.net/php5/pecl-5.2.5-Win32.zip

3.rename php.ini-dist to php.ini in c:\php-5.2.6-Win32

4.Uncomment or add the line (remove semi-colon at the beginning) in php.ini:
;extension=php_java.dll

5.copy php5servlet.dll from PECL 5.2.5 to c:\php-5.2.6-Win32

6.copy php_java.dll from PECL 5.2.5 to c:\php-5.2.6-Win32\ext

7.create a directory named "php" (or what ever u like) in tomcat\webapps directory

8.copy phpsrvlt.jar from PECL 5.2.5 to tomcat\webapps\php\WEB-INF\lib

9.unjar or unzip phpsrvlt.jar
for unzip use winrar or winzip
for unjar use : jar xfv phpsrvlt.jar

10.change both net\php\reflect.properties and net\php\servlet.properties to library=php5servlet

11.Recreate the jar file
-> jar cvf php5srvlt.jar net/php/*.*
PS: if the jar file doesnt run you have to add the Path to system variables
for me I added C:\Program Files\Java\jdk1.6.0\bin; to System variables/Path

12.creat web.xml in tomcat\webapps\forphp\WEB-INF with this content:


<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">

<servlet>

<servlet-name>php</servlet-name>

<servlet-class>net.php.servlet</servlet-class>

</servlet>

<servlet>

<servlet-name>php-formatter</servlet-name>

<servlet-class>net.php.formatter</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>php</servlet-name>

<url-pattern>*.php</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>php-formatter</servlet-name>

<url-pattern>*.phps</url-pattern>

</servlet-mapping>

</web-app>


13.Add PHP path( c:\php-5.2.6-Win32) to your System or User Path in Windows enironment (Hint: Right-click and select Properties from My Computer

14. create test.php for testing under tomcat\webapps\php like

15.Restart tomcat

16.browse http://localhost:8080/php/test.php