php-src/sapi/servlet
Sascha Schumann 9d9d39a0de Please welcome the new build system.
If you encounter any problems, please make sure to email sas@php.net
directly.

An introduction can be found on

http://schumann.cx/buildv5.txt
2002-03-07 14:20:02 +00:00
..
config.m4 Please welcome the new build system. 2002-03-07 14:20:02 +00:00
cookies.php use simpler foreach instead of while 2000-05-21 11:26:26 +00:00
CREDITS 2nd step towards auto-credits 2000-11-20 10:33:33 +00:00
date.php Improved handing of instances of private classes. Added servlet examples. 2000-02-28 17:02:28 +00:00
EXPERIMENTAL Mark sapi/servlet as what it is: experimental. 2001-12-04 13:20:26 +00:00
formatter.java Update headers. 2001-12-11 15:32:16 +00:00
jinfo.php Improved handing of instances of private classes. Added servlet examples. 2000-02-28 17:02:28 +00:00
jver.php Improved handing of instances of private classes. Added servlet examples. 2000-02-28 17:02:28 +00:00
Makefile.frag Please welcome the new build system. 2002-03-07 14:20:02 +00:00
README Fugbix typo. 2002-02-11 16:29:51 +00:00
reqheaders.php Cleanup 2000-03-06 13:19:58 +00:00
reqinfo.php Cleanup 2000-03-06 13:19:58 +00:00
reqparams.php Fix for JDK1.2.2/Tomcat3.2 2000-07-09 04:09:47 +00:00
servlet.c Remove obsolete CG(extended_info) = 0 calls, we already do this in zend_set_default_compile_time_values(). 2002-02-02 19:53:43 +00:00
servlet.dsp Removing winutil.c from this project. the functions needed are found in php4ts.dll 2001-11-27 00:08:36 +00:00
servlet.java URLEncoder.encode(string) is deprecated in the Java 2 SDK 1.4. 2002-02-27 07:29:33 +00:00
sessions.php match changes to Tomcat example 2000-04-13 19:02:40 +00:00
web.xml Fix for Tomcat 4. 2001-10-27 23:14:49 +00:00

Java Servlet SAPI Module for PHP 4


  Introduction

    The Java Servlet SAPI Module allows for the execution of PHP 4 as
    a Servlet from within a Java Servlet Engine, such as Apache's
    Jakarta Tomcat [1]. It builds upon the mechanism defined by PHP's
    Java Extension, which can be found in /php4/ext/java.

    The primary advantage of this from a PHP perspective is that web
    servers which support servlets typically take great care in
    pooling and reusing Java Virtual Machines (JVMs).

    PHP may also be bridged with the Apache Cocoon XML Publishing
    Framework. [2]

    A suitably configured system will invoke the PHP binaries through
    JNI and the output of the page will be processed through the
    configured XML parser and placed into the pipeline for processing
    by such filters as XSLT. This enables PHP developers to access the
    powers of Cocoon to separate their content, style, and logic
    without requiring them to write a single line of Java code.

    While this code is intended to be able to run on any servlet
    engine, it has only been tested on Apache's Jakarta Tomcat to
    date. Bug reports, success stories and/or patches required to get
    this code to run on other engines would be appreciated; please
    send them to the PHP Development Mailinglist [3].

    Note: PHP has a habit of changing the working directory. The Java
    Servlet SAPI Module will eventually change it back, but while PHP
    is running the servlet engine may not be able to load any classes
    from the CLASSPATH which are specified using a relative directory
    syntax, or find the work directory used for administration and JSP
    compilation tasks.


  Installing PHP as a Servlet into Apache's Jakarta Tomcat

    1.) Build the PHP 4 Java Servlet SAPI Module

        UNIX

          o ./configure --with-servlet --with-java

          o Add directory containing libphp4.so to LD_LIBRARY_PATH

        Windows

          o Build ext/java/java.dsp, copy php_java.dll to your
            extension_dir directory and enable the extension in the
            php.ini

          o Build sapi/servlet/servlet.dsp

          o Add directory containing php4ts.dll and phpsrvlt.dll to
            PATH

    2.) Tomcat 3

          * Add phpsrvlt.jar to CLASSPATH

        Tomcat 4

          * Copy phpsrvlt.jar into your $CATALINA_HOME/lib directory

    3.) Tomcat 3

          * Merge or overwrite build/tomcat/examples/WEB-INF/web.xml
            with the configuration directives from the web.xml file
            that comes with the Java Servlet SAPI Module.

        Tomcat 4
    
          * Merge the configuration directives from web.xml file that
            comes with the Java Servlet SAPI Module into your
            Tomcat/conf/web.xml configuration file.

            Make sure that the element ordering of the web.xml is legal
            with Tomcat and put all the <servlet> declarations first,
            followed by all the <servlet-mapping> declarations.

          * Add

              <welcome-file>index.php</welcome-file>

            to the

              <welcome-file-list>
                ...
              </welcome-file-list>

            block of your Tomcat/conf/web.xml configuration file.

    4.) Test your installation by creating a test.php file in your
        Tomcat/webapps/ROOT directory with

          <?php phpinfo(); ?>

        in it.

        Access this file in your browser at

          http://localhost:8080/test.php

        and you should see the familiar output of phpinfo().


  Installing PHP as a Generator into Apache's Cocoon2 Framework

    1.) Build the Java Servlet SAPI Module as described above.

    2.) Get the Cocoon2 source tree, either by CVS or from a release
        archive; a binary distribution does not suffice. Copy the
        phpsrvlet.jar file into your xml-cocoon2/lib/optional directory
        and build Cocoon.

-- 
 [1] http://jakarta.apache.org/tomcat/
 [2] http://xml.apache.org/cocoon2/
 [3] http://www.php.net/support.php