Mindon.IDEA

Air off, Mind on ~ / Javascript+Golang, Sci, Health… /

Php5 in Tomcat

BlogMS original blog key: 1000499939, blog id: airoff History stat: 浏览/评论:192/0 , 日期:2005年8月4日 10:38

use php-5.1.0b3-Win32 & pecl-5.1.0b3-Win32 and Apache Tomcat 5.0.24 Server in win2000(win2k, windows2000):

1, download php-5.1.0b3-Win32.zip & pecl-5.1.0b3-Win32.zip from http://www.php.net/.

2, unzip php-5.1.0b3-Win32.zip into a folder named such as "d:\php";

3, unzip pecl-5.1.0b3-Win32.zip into a new folder under "d:\php" named "pecl", i.e. "d:\php\pecl";

4, rename the file "php.ini.dist" in "d:\php" to "php.ini";

5, copy and rename "d:\php\pecl\php5servlet.dll" to "Tomcat\bin\php5srvlt.dll", because in the packet phpsrvlt.jar the net/php/reflect.properties the configuration is library=php5srvlt, and the same with net/php/servlet.properties.

6, copy "d:\php\pecl\phpsrvlt.jar" to "Tomcat\common\lib";

7, modify "Tomcat\conf\web.xml"

add php servlet configuration:


<servlet>

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

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

<load-on-startup>3</load-on-startup>

</servlet>


and add its servlet-map as following:


<servlet-mapping>

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

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

</servlet-mapping>


8, set environment variables

PHP_HOME=d:\php

LD_LIBRARY_PATH=%PHP_HOME%/libs;%PHP_HOME%/pecl

append %PHP_HOME%;;%PHP_HOME%/pecl; to the PATH variable.

9, restart Tomcat

  1. prepare a test.php only with following single line

<?php phpinfo(); ?>


then put it into "Tomcat\webapps\Root"

try to access the test.php in your browser.

Comments