84 lines (58 with data), 3.2 kB
Installing the PHP/Java Bridge on Windows
-----------------------------------------
It is recommended to use the Linux or Unix version of the PHP/Java
Bridge. Especially the Linux version can be installed very easily
(with the command rpm -i php-java-bridge*.rpm), supports fine-grained
access control through SEL, struct ucred and the linux abstract
namespace and allows one to audit the activity going through the web
server and the bridge.
* Install a J2RE >= 1.4.0, for example Sun JDK 1.5.0
* Download and extract php-java-bridge_*-win32-php5.zip into the
folder: c:\php5.
* Double-Click on c:\php5\JavaBridge.jar
* Open a command window in c:\php5 and type:
.\php-cgi test.php >result.html
Open the file result.html with a browser. Search for the "java
status" entry, it should be "java status: running", and examine the
java properties at the bottom of the page. Search for "file.encoding",
it should be UTF-8.
* Copy your java libraries (.jar files) into "java.ext.dirs" (see
result.html). Copy the php_java.dll into the extension directory
of your PHP 5.0.3 installation. (Or copy php-cgi.exe, php5ts.dll
and php_java.dll into the CGI bin folder of your web server and
re-start the web server.)
* Add the following entry to your php.ini:
extension = php_java.dll
[java]
java.hosts="127.0.0.1:9167"
* Copy the test.php into your web-server document root and browse to:
http://localhost/test.php
* If you have problems, start the PHP/Java Bridge at log level 3
java -jar JavaBridge.jar 9167 3 output.log
or a higher log level and examine the output. Please report
bugs/problems to the mailing list:
php-java-bridge-users@lists.sourceforge.net
Known Windows Issues
--------------------
* Security Enhanced Linux not supported.
* Local ("unix domain") sockets, struct ucred and the Linux abstract
namespace not supported.
* You cannot install your .jar files in /usr/share/java. Install your
.jar files into %JAVA_HOME\jre\lib\ext instead and then re-start the
java VM.
* Windows 98 does not support UTF-8. To force the bridge to use UTF-8
anyway, start it with: java -Dfile.encoding=UTF-8 JavaBridge.jar
* Both, the CGI version and the apache or isapi module are
supported. But it is recommended to use the CGI version:
Due to bugs in PHP5 the module version may leak resources. You can
test this by starting the bridge with the command: java -jar
JavaBridge.jar 9167 5 "" and then type: php-cgi.exe -i. If you see a
"java.net.SocketException: Connection reset" exception message, this
means that your PHP version cannot handle resources correctly. -- The
exception means that PHP did not call the RSHUTDOWN hook and that the
socket was destroyed by the operating system upon CGI termination. If
this happens with the module version, the socket will stay open and
the operating system will run out of socket handles after some time.
The leak described above happens very seldom, for example if
the PHP script is very short. But it may happen, not only with
the PHP/Java Bridge but also with SOAP and other modules.