THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- Extract the source code to PHP in a work directory
- Patch if needed (that is, patch if building PHP to run with Tomcat version 5 or later)
- Run
configure
, thenmake
in the top directory of the PHP sources:No Format ./configure --with-servlet=$TOMCAT_HOME --with-java=$JAVA_HOME make
- A jar file and dynamic library are produced from the
make
:sapi/servlet/phpsrvlt.jar and libs/libphp4.so
. - Copy the jar file to your web application's class repository, or, alternately, to Tomcat's common class repository (as is shown here):
No Format cp $PHP_HOME/sapi/servlet/phpsrvlt.jar $TOMCAT_HOME/common/lib
- Declare PHP servlet and servlet-mapping in the web applications
web.xml
file, or in Tomcat's sharedweb.xml
file:- Copy from
$PHP_HOME/sapi/servlet/web.xml
the servlet and servlet-mapping and paste into the file$TOMCAT_HOME/conf/web.xml
.
- Copy from
- Modify your LD_LIBRARY_PATH to include the dynamic library produced in the first step above:
No Format LD_LIBRARY_PATH=$PHP_HOME/libs export LD_LIBRARY_PATH
Fedora Core 1 Issues with Tomcat 5.5.9, PHP 4.3.11 and jdk1.5.0_03
This may have just been an issue with the particular system I was building, but I was unable to set $JAVA_HOME, $PHP_HOME, $TOMCAT_HOME, or $LD_LIBRARY_PATH at the command line. The workaround was to edit /etc/profile
and add the variables there (i.e., and the line
No Format |
---|
JAVA_HOME=/usr/java/jdk1.5.0_03 |
and add JAVA_HOME
to the export
variables).
- If
make
returns an error wherejavac
is not a recognized command, you'll need to patch the Makefile produced by./configure
. Look for "&& javac
" and replace it with the full path to javac (i.e., "
").No Format && /usr/java/jdk1.5.0_03/bin/javac
- If
make
returns an error regarding "enum" while trying to build phpsrvlt.jar, you'll need to edit$PHP_HOME/sapi/servlet/servlet.java
and replaceenum
withxenum
.
Start Tomcat
No Format |
---|
$TOMCAT_HOME/bin/startup.sh. |
...