22 November 2007 View Comments

Installing the PHP Java Bridge in Ubuntu (Gutsy Gibbon)

If you’re looking for the easiest way to install the PHP Java Bridge in Ubuntu, follow these simple steps:

If you don’t have Java Installed on your machine, enable the multiverse option in your Software Sources and run

sudo apt-get install sun-java6-jre sun-java6-fonts sun-java6-jdk sun-java6-plugin
sudo update-java-alternatives -s java-6-sun

Download the PHP Java bridge deb files from Sourceforge.

Head over to the directory where you’ve downloaded this deb file, and fire the following commands:

sudo apt-get install liblucene-java libitext-java
sudo dpkg -i php-java-bridge_4.3.0-1_i386.deb

Once the php-java-bridge deb file is installed, apache will be automatically restarted. If apache doesn’t restart automatically, you can restart apache with the following command:

sudo /etc/init.d/apache2 restart

How do you check if the PHP Java bridge is installed?
Run the phpinfo() command in php. This should give you the details of the PHP Java bridge extension under the Java Heading. Now you’re ready to run Java code in PHP :)

Now head over to the following link and check out the second part of the tutorial to get started on PHP and Java.
http://www.hiveminds.co.uk/node/3172

More on the PHP Java bridge over at: http://php-java-bridge.sourceforge.net/

Updates:

Here’s another Article which shows how to bridge PHP an Java in Windows using Apache Tomcat:
http://www.hiveminds.co.uk/node/3814

Tags: ,