Installing PHP Java Bridge on Ubuntu
Source Install
First, make sure all php packages are updated — if you update PHP after installing this, it will likely segfault.
For the purpose of this, I’m using Ubuntu 7.10, and Java 6 (sun-java6)
First, get the build essential, as well as php5-dev, sun java and automake
# apt-get install build-essential php5-dev sun-java6-jre \
sun-java6-jdk sun-java6-source automake
Second, get the PHP/Java bridge source.
# cd /usr/src # wget http://internap.dl.sourceforge.net/sourceforge/php-java-bridge/php-java-bridge_5.2.0.tar.gz # tar xzfv php-java-bridge_5.2.0.tar.gz
And, install.
# cd /usr/src/php-java-bridge-5.2.0 # phpize # ./configure --with-java=/usr/lib/jvm/java-6-sun-1.6.0.03,/usr/lib/jvm/java-6-sun-1.6.0.03 # make # chmod +x install.sh # ./install.sh
Answering the questions for the install script is fairly simple. It looks for some tomcat stuff for the servlet portion of the Java Bridge, but we won’t be using it.
Copy *.inc to someplace it can be found.
# mkdir /usr/share/php/java # cp *.inc /usr/share/php/java
Testing,
# php test.php
By default, java is only enabled in the command line php; to enable it in the global instances of php, edit the php.ini file and add the extension.
;; java.ini: Activate the PHP/Java extension ;; zend_extension = "/path/to/java.so" extension = java.so ;; If you have installed the java-servlet.ini leave this file alone, ;; edit the servlet or standalone ini file. Otherwise uncomment the ;; following java section and one of the following options: [java]
There are no other options required. Make sure the java.hosts and java.servlet are disabled. If logging is desired, that’s another story.
June 6th, 2008 at 8:06 am
Do the instructions for installing the PHP Java Bridge work for the latest version of Ubuntu (Herron)?
June 6th, 2008 at 9:24 am
Hello,
I am setting up the PHP Java bridge. Everything seemed to go OK, until I ran the php test.php. On examining the error output, it appears to be failing because port 8080 is not open. Is opening this port a requirement for the bridge or did I blow the install?
Or could it be a version problem? The web server is running Herron.
June 7th, 2008 at 10:24 pm
Hi, I believe if you comment out these two lines:
; java.hosts = 127.0.0.1:8080
; java.servlet = On ;; Off, On or User
found in your php5/conf.d/java.ini file you should be ok.
I haven’t officially tested my method with 8.04, but I’m assuming by your second comment it was successful.
Hope that helps.