--- a/trunk/php-java-bridge/README
+++ b/trunk/php-java-bridge/README
@@ -1,12 +1,13 @@
What is the PHP/Java bridge?
- The PHP/Java bridge can access java based applications running in
- a java application server running on the local host. The
- PHP/Java bridge communicates with the application server through
- local sockets using an efficient communication protocol. This
- means that only one JVM runs to serve all clients within a
- multi-process HTTP-Server. Each client process communicates with
- a corresponding thread spawned by the running application server.
+ The PHP/Java bridge allows one to access java based
+ applications running in a java application server running
+ on the local host. The PHP/Java bridge communicates with
+ the application server through local sockets using an
+ efficient communication protocol. This means that only one
+ JVM runs to serve all clients within a multi-process HTTP-Server.
+ Each client process communicates with a corresponding thread
+ spawned by the running application server.
If the bridge detects that a java application server is not
already running, it starts one to serve further requests.
@@ -16,27 +17,31 @@
document root of you web-server and invoke the file using the
browser.
+ The PHP/Java bridge is meant as a replacement for the ext/java
+ bridge shipped with PHP 4. It is not possible to run the
+ build-in bridge and the PHP/Java bridge at the same time.
+
Build and execution instructions:
- In the directory java type:
+ In the directory php-java-bridge_1.x.y type:
- php --version # must be PHP 4.3.3 or above!
- phpize && ./configure --with-java=/opt/jdk1.4 && make
+ php --version # must be PHP 4.3.2 or above!
+ phpize && ./configure --with-java=/opt/IBMJava2-141/ && make
su <password>
make install
and then activate the extension by adding the following lines to
the php.ini or add a file java.ini to the directory that
- contains the php module descriptions (usually /etc/php/) with
+ contains the php module descriptions (usually /etc/php.d/) with
the following content:
extension = java.so
[java]
java.log_level=5
java.log_file=/tmp/java.log
- java.socketname=/tmp/.php_java
+ #java.socketname=/tmp/.php_java
After the module is activated, verify that the module is running
by typing:
@@ -47,8 +52,9 @@
restart the Web-Server after you have installed the extension.
This module has been tested on a Mandrake Linux System (Version
- 9.2), but it should run on all Unix-like operating systems
- including RedHat9, Solaris, Mac.
+ 9.2), on RedHat Enterprise 3, RedHat Fedora Core 1 and 2, but
+ it should run on all Unix-like operating systems including
+ Solaris, Mac.
However, the extension currently does not compile on systems
which do not support fork()/exec(). On these systems you must
@@ -60,14 +66,89 @@
Other configuration options which should have been set up by the
configure script but which can be changed later are:
- java.libpath = <system dependent path to natcJavaBridge.so>
- java.classpath= <system dependent path to JavaBridge.class>
- java.home = <system dependent path to the java install dir>
+ java.libpath = <system dependent path to natcJavaBridge.so>
+ java.classpath = <system dependent path to JavaBridge.class>
+ java.home = <system dependent path to the java install dir>
+ java.socketname= <hard-coded socketname for debugging>
If you change the above values, please fist look at the output
of phpinfo() so see the original values.
+ For debugging you can also start a external java application
+ with the following command:
+ JAVA_HOME=<java.home> <java.home>/bin/java \
+ -Djava.library.path=<java.libpath>
+ -Djava.class.path=<java.classpath>
+ -Djava.awt.headless=true
+ JavaBridge
+ <java.socketname>
+ <loglevel>
+ <log-file>
+
+ For example in a gnome-terminal type:
+
+ JAVA_HOME=/opt/jdk1.4 $JAVA_HOME/bin/java \
+ -Djava.library.path=/usr/lib/php4 \
+ -Djava.class.path =/usr/lib/php4 \
+ -Djava.awt.headless=true \
+ JavaBridge \
+ /tmp/.php_java \
+ 5 \
+ "" | tee /tmp/java.log
+
+ Then point the bridge to the socket /tmp/.php_java by
+ hard-coding the java.socketname to /tmp/.php_java and
+ re-start the apache service.
+
+------------------------------------
+ QUICK INSTALL:
+
+ su - -c "service httpd stop"
+ INST=/usr/local
+
+ gunzip < httpd_2.x.y.tar.gz | tar xf -
+ cd httpd_2.x.y
+ ./configure --prefix=$INST
+ make && su -c "make install"
+ cd ..
+
+ bunzip2 < php-4.3.x.tar.bz2 | tar xf -
+ cd php-4.3.x
+ ./configure --prefix=$INST \
+ --with-mysql \
+ --without-java \
+ --with-apxs2=$INST/bin/apxs
+ make && su -c "make install"
+ # now activate php in the httpd.conf
+ su -c "echo 'AddType application/x-httpd-php .php' >>$INST/conf/httpd.conf"
+ cd ..
+
+ bunzip2 < php-java-bridge_1.x.y.tar.bz2 | tar xf -
+ cd php-java-bridge_1.x.y
+ export PATH=$INST/bin:$PATH
+ export LD_LIBRARY_PATH=$INST/lib:$LD_LIBRARY_PATH
+ phpize
+ ./configure --prefix=$INST \
+ --with-java=/opt/IBMJava2-141
+ make && su -c "make install"
+ # now activate the bridge in php.ini
+ su -c "touch $INST/lib/php.ini && echo -e 'extension=java.so\n[java]' >>$INST/lib/php.ini"
+ cd ..
+
+ # test
+ su -c "echo '<?php phpinfo() ?>' >$INST/htdocs/phpinfo.php; chmod +xr $INST/htdocs/phpinfo.php; apachectl restart"
+
+ # checking cli
+ echo '<?php phpinfo() ?>' | php | fgrep "java status"
+
+ # checking web
+ wget -olog -O- http://localhost/phpinfo.php|fgrep "java status"
+
+
+------------------------------------
+
+
This module is based on the ext/java module written by Sam Ruby.
His original comments follow.