Installation on RedHat Linux (RHEL, Fedora, ...)
-------------------------------------------------

* Install a J2RE, for example with the command:
  rpm -i IBMJava2-JRE-1.4.1-8.i386.rpm

* Install PHP, for example with the command: 
  rpm -i php-4.3.2-8.ent.i386.rpm

* Install the web-server, for example with the command:
  rpm -i httpd-2.0.46-25.ent.i386.rpm

* Install the php-java-bridge, for example with the command:
  rpm -i php-java-bridge-X.Y.Z-1.i386.rpm

* If you have SECURITY ENHANCED LINUX, the above command should have
  provided instructions how to install the php-java-bridge.te and
  php-java-bridge.fc policy files.

Start the web-server with the command: service httpd restart.
Start the bridge with the command: service php-java-bridge restart

Create a simple php file in /var/www/html, for example with
the command: echo "<?php phpinfo(); ?>" >/var/www/html/phpinfo.php.

Browse to http://localhost/phpinfo.php and search for the 
output of the php java bridge module (the entry should be: 
"java.support: Enabled").

Then install your your java libraries (.jar files) in /usr/share/java
or in java.libpath/lib (see output of phpinfo) and your php and
web-pages in /var/www/html or one of their sub-directories.


Installation a generic Linux distribution (e.g: Slackware)
----------------------------------------------------------

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

* Download and extract php-java-bridge_*-linux-php5.tgz into a folder.

* Double-click on test.sh
  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 the
  "extension_dir", it should be "./ext" for this test.


If the above test succeeded, install the php.ini, the java.so,
libnatcJavaBridge.so and your java libraries (.jar files):

* Copy or add the contents of the ./php.ini file to the php.ini in the
  linux system directory (usually /etc/php.ini or
  /usr/local/lib/php.ini) and edit it so that the "extension_dir" points
  to your PHP 5 extension directory. Copy the java.so,
  libnatcJavaBridge.so and JavaBridge.jar from the ext folder into the
  extension_dir and copy your java libraries (.jar files) into
  extension_dir/lib.

* If you don't have a servlet engine, enable the java.socketname
  option in your php.ini file and copy php-java-bridge to /usr/sbin,
  make it executable: chmod +x /usr/sbin/php-java-bridge and start the
  standalone backend once: /usr/sbin/php-java-bridge. Then copy the
  test.php into your web-server document root and browse to:

    http://localhost/test.php

* If there are problems, edit your php.ini and set the java.log_level
  to 3 or a higher log level and examine the log file of the servlet
  engine or "/var/log/php-java-bridge.log".

  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 backend with debug output enabled:

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

 * Please report bugs/problems to the mailing list:

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


Known Linux Issues 
-------------------

* All modern Linux installations have Security Enhanced Linux switched
  on in the Linux kernel, please see the README and the SEL documentation 
  from the NSA for details. -- During development you can set it to
  permissive using the command: setenforce permissive. Violations are
  reported via the /var/log/audit/audit.log.

* Until a bug in the GNU JVM is fixed please use IBM, SUN or Blackdown java
  instead. You can check the java version using the command: java -version.
  All java versions <= "gij (GNU libgcj) version 4.0.0" may create
  incorrect bytecode:

    public abstract class bug {
        protected void kill() {System.out.println("okay");}
        protected abstract void init();
        public static bug getBug() {return new bug(){protected void init() {kill();}};}
        public static void main(String s[]) { bug.getBug().init(); }
    }

  The above code will produce a null pointer exception because kill()
  is not called via "invokevirtual" but referenced through "this", which
  is not available in the above context.
