Mixing Java and PHP
2004 May 28 at 17:17 » Tagged as :
I tried compiling java support for PHP a couple of days ago with out much success. Yesterday I found myself on windows after sometime and decided to see try out java extension on windows. It worked like a charm, (which I found rather disappointing).
Determined to get this setup on linux I decided to visit the manual page on the php.net and read all the user contributed comments.
In case you are wondering, I did RTFM before trying out the install, some of the pages feel like old friends. However I have the manual installed locally (bandwidth is very expensive in my country) Unfortunately the local copy does not contain user contributed comments. It is in this user contributed comments that I found the solution. As always happens on unix like operating systems the solution was trivial.
All I had to do (as suggested by [phpnet AT devnull DOT org DOT uk]) was to create a symlink to java.so
ln -s java.so libphp_java.so
That's it! In case you want a peek at my php.ini file here it is
[Java]
java.class.path =/usr/lib/php4/php_java.jar
java.home = /opt/java/j2sdk1.4.2/
java.library = /opt/java/j2sdk1.4.2/jre/lib/i386/server/libjvm.so
java.library.path = /usr/lib/php4/
extension_dir=/usr/lib/php4/
extension=java.so
I have been promising myself that I will do some projects that makes full use of both PHP and Java for a long long time. Now I can get started on it.
footnote (July 09, 2004) :