Installing the PHP/Java Bridge on Windows
----------------------------------------- 

* Install a J2RE >= 1.4.2, for example Sun JDK 1.5.0

* Extract the files from the php-java-bridge J2EE download and deploy
  JavaBridge.war into your J2EE server, visit
  http://localhost:<port>/JavaBridge and click on test.php.
  The <port> is 8888 (Oracle), 9080 (WebSphere) or 8080 (Tomcat).

* Please see the README and http://php-java-bridge.sourceforge.net for
  further information.


Installing and testing the front-end on Windows
-----------------------------------------------

If the above test succeeded (or if you have skipped the test because
you don't want to use a J2EE server), install a HTTP server, PHP, the
php.ini, the php java extension "php_java.dll" and your java libraries
(.jar files):

* Install IIS or Apache, if not already installed.

* Download and extract the php-5.1.x-Win32.zip into c:\php\. For
  example with the commands:

    c:
    mkdir php
    cd php
    jar xvf c:\php-5.1.x-Win32.zip

* Install PHP as an IIS or Apache module. For example add these lines
  to the end of your Apache2 httpd.conf file:

    LoadModule php5_module "c:/php/php5apache2.dll"
    AddType application/x-httpd-php .php

* Add the following to the php.ini in the windows system directory
  (usually c:\winnt or c:\windows) and edit it so that the
  "extension_dir" points to your PHP 5 extension directory. 
  
    extension_dir = "c:\php"
    extension = php_java.dll

* Copy the appropriate java-x86-windows.dll (from the JavaBridge.war)
  into the extension_dir:

  for PHP >= 4.3.4: php-4-java-x86-windows.dll
  for PHP >= 5.0.0: php-5.0-java-x86-windows.dll
  for PHP >= 5.1.0: java-x86-windows.dll
  for PHP >= 6.0.0: php-6-java-x86-windows.dll

  Rename it to php_java.dll. Or compile a php_java.dll from the
  source, as described in the INSTALL document located in the source
  download archive.

* Copy your java libraries (.jar files) into extension_dir\lib.

* If you have a servlet engine or j2ee server, edit the [java] section
  of your php.ini file so that it contains:

    [java]
    java.hosts      = 127.0.0.1:8080 ;or 8888 for Oracle, 9080 for WebSphere
    java.servlet    = On
    java.log_level  = 3

* If you don't have a servlet engine, copy the file JavaBridge.jar
  (from the JavaBridge.war) into the extension_dir and edit the [java]
  section of your php.ini file so that it contains:

    [java]
    ;java.socketname = 9267
    ;java.java        = c:/jdk1.5/jre/bin/javaw.exe
    ;java.java_home   = c:/jdk1.5
    java.log_level   = 2

  If you set the java.socketname, you must double-click on
  JavaBridge.jar to start the standalone back-end once. If you leave it
  off, the back-end automatically starts the default javaw or the
  specified "java.java" program when your HTTP server starts.

* Copy the test.php (from the JavaBridge.war) to your web server
  document root, re-start the web server and check "java status" and
  "java server":

    http://yourHost/test.php

* If you have a servlet engine or j2ee server and you want to share
  the web server document root with the servlet engine or j2ee server,
  change the web server document root. The following example sets the
  document root in the apache2 httpd.conf to the tomcat 5 webapps
  directory:

    DocumentRoot "c:\Programme\Apache Software Foundation\Tomcat 5.5\webapps"
    <Directory "c:\Programme\Apache Software Foundation\Tomcat 5.5\webapps">

  Edit the [java] section of your php.ini file so that it contains:

    [java]
    java.hosts      = 127.0.0.1:8080 ;or 8888 for Oracle, 9080 for WebSphere
    java.servlet    = User
    java.log_level  = 3

  Restart the web server and check "java status" and "java server":

    http://yourHost/<userContext>/test.php

  e.g:

    http://yourHost/JavaBridge/test.php


* On production systems set the following flags in your php ini file
  so that the back-end can generate standard error pages.

    log_errors     = On
    display_errors = Off
    html_errors    = Off

* If there are problems, edit your php.ini and set the java.log_level
  to 4 or a higher log level and examine the log file of the servlet
  engine or "JavaBridge.log" located in the directory from which the
  JavaBridge.jar was started.

  If your php.ini does not have a java.log_level entry, the bridge
  uses the log level supplied when it was started. For example the
  following command starts the back-end with debug output enabled:

    java -Djava.awt.headless=true -jar JavaBridge.jar INET:9267 4

 * Please report bugs/problems to the mailing list:

    php-java-bridge-users@lists.sourceforge.net


Known Windows Issues 
--------------------

* It is recommended to start Java outside of the HTTP server domain,
  for example from a separate service script. The Apache/Tomcat servlet
  engine for example installs such a service. It can be used by setting
  the php.ini [java] options: java.servlet=On java.hosts=127.0.0.1:8080.

* On windows the standalone Java program is called javaw.exe, not
  java.exe. The java.exe can only be used from a console/terminal.

* Local ("unix domain") sockets or named pipes, which are more than 3
  times faster and more secure than TCP sockets, are not available. --
  It is possible to implement a named pipe communication channel on some
  windows variants, too. On Win>=2000, jdk1.5 it should be possible to
  create a windows named pipe with PIPE_ACCESS_DUPLEX, call Accept in
  the java extension's C code and modify the java back-end to not use a
  Input or OutputStream but a RandomAccessFile. Please write to the
  mailing list if you want to implement it.

* A standalone FastCGI server is not available on windows. When Apache
  or IIS is not available, the bridge uses the CGI interface. This is more
  than 5 times slower than FastCGI.

* Some public domain programs such as "WinZip" or "WinRar" destroy 
  java file associations, a double-click on JavaBridge.jar opens that
  file in the archive manager. Please either remove these programs
  ("jar xvf archive.name" can be used instead) or install Sun java
  again to overwrite the incorrect registry entries.
