Fraser MacKenzie wrote:

> Alex, Ok...so far, I have progress.  I have PHP recognizing Java... or at
> least, phpinfo() does.
>
> Now, when I try to do a new Java("class");
>
> I get the following error:
>
> Fatal error: Unable to load Java Library
> 
>/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so,
> error:
> 
>/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so:
> cannot
> open shared object file: No such file or directory in
> /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34
>
It's really confused since you gave it way too much information.  I'm gonna help you 
clean this up a bit and hopefully explain things a bit so that they make sense.  See 
below.

> Here is the appropriate info from my php.ini file:
>
> [Java]
> 
>java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar:/home/local/java/jdk1.2.2/jre/lib:/home/local/java/jdk1.2.2/jre/bin
>
Remove the last two directories as they serve no purpose.  This entry is essentially 
an extension to the system CLASSPATH and should only contain directories and jars that 
contain java classes
or java resource files.

> java.home=/home/local/java/jdk1.2.2/bin:/home/local/java/jdk1.2.2/jre/bin
>
There should be only one java.home.  It should point at the base directory of the jdk 
(similar to what you specified on the --with-java=... expression).  In this case, use
java.home=/home/local/java/jdk1.2.2

> 
>java.library.path=/home/local/src/php-4.0.4/ext/java:/home/local/java/jdk1.2.2/jre/lib/i386
>
This entry is essentially equivalent to LD_LIBRARY_PATH.  Not sure if 
/home/local/src/php-4.0.4/ext/java contains any shared libraries (.so extension).  If 
not, it doesn't belong here.  However,
you should have /usr/local/lib/php/extensions/no-debug-non-zts-20001214 (location of 
libphp_java.so) listed here.  Also, you might also need to list the other directories 
in the JDK that may
contain shared libraries that you need (e.g. 
/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads).
  A good
way to find out what these are is to go into the 
/home/local/java/jdk1.2.2/jre/lib/i386 directory and run ldd libjava.so and then add 
the directories that contain the shared libraries that
libjava.so depends on to the java.library.path (or LD_LIBRARY_PATH).

> 
>java.library=/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so
>
Again, you should only have one entry here and it should simply be the name of the jvm 
shared library (i.e. java.library=libjava.so).  This library will be searched for in 
your LD_LIBRARY_PATH
or java.library.path which you specified above.  Note that on some systems/jdk's you 
might need to specify java.library=libjvm.so.  Specifically, I found I had to do that 
on Solaris or I would
start getting "Cannot locate CreateJavaVM function" errors.

> extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214
> extension=libphp_java.so
>
This part looks good.

> Any help you can offer is greatly appreciated.
>
You're welcome.  Hope this helps.

> Fraser
>
Alex

Reply via email to