Greetings PHP project,
I have created a patch for the Servlet SAPI package to
improve the stability of the JVM runtime environment
when making calls from Java to PHP. This patch is for
the 4.3.x branch. Many bugs have been reported regarding
various issues with this experimental module (ref. #17020
as an example).
I believe this patch will correct several of the bugs that
have been reported on the Servlet SAPI module. Please
review and advise if you have any questions or concerns.
It would be great to see these changes make it into an
upcoming 4.3.x bugfix release.
Here is a link to the patch:
http://www.tachometry.com/support/patches/php_4.3/sapi_servlet_patch.txt
I have also included a brief description of the fix and the
steps we used to successfully deploy and test the modified
Servlet SAPI module. We are using this build to integrate PHP
with JSP/Struts inside the Tomcat container (4.1.29) for one
of our current development projects, with good results.
Regards,
Tom Evans
Tachometry
Open Source that means business.
http://www.tachometry.com/
[from
http://www.tachometry.com/support/patches/php_4.3/sapi_servlet_notes.txt]
Build Notes
This folder contains patched sources required to build
The Servlet SAPI module for PHP 4.3.6. The changes are
to correct several instability problems when the PHP
engine is embedded within a JVM container. Note that the
Servlet SAPI module is EXPERIMENTAL and is subject to
name changes and other significant refactoring. It has
been moved to the pecl/servlet/ directory as of PHP 5.0.
The patch adds a SAPI callback to register a subset
of server variables (e.g. PHP_SELF, REQUEST_URI, etc.)
that are readily available in the current module. In
addition, the exception handling has been improved to
return a proper 404 response to the servlet container
if a PHP resource is not found. Finally, a line of
code was removed that was causing the SAPI module to
shutdown prematurely under certain conditions.
This patch was built from PHP sources (branch PHP_4_3) on
May 24, 2004 by Tom Evans of Tachometry Corporation.
Released under the terms of the PHP License, version 3.0
(http://www.php.net/license/3_0.txt).
Source files:
sapi/servlet/servlet.c
sapi/servlet/servlet.java
Binaries (Linux):
libs/libphp4.so (copied to $JAVA_HOME/jre/lib/i386/ directory)
libs/phpsrvlt.jar (copied to $TOMCAT_HOME/common/lib/ directory)
Build arguments:
export CFLAGS=-g3
export CLASSPATH=$TOMCAT_HOME/common/lib/servlet.jar
./configure --with-java --with-servlet --enable-debug
make
make test