Re: Running java under php4 (PHP4 ext/java)

From: Date: Fri, 19 Jan 2001 17:52:28 +0000
Subject: Re: Running java under php4 (PHP4 ext/java)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35660@lists.php.net to get a copy of this message
Ok. I have done what you said, but I am now getting: <b>Fatal error</b>: Unable to load Java Library /home/local/java/jdk1.2.2/jre/lib/i386/libjava.so, error: libhpi.so: cannot open shared object file: No such file or directory in <b>/home/rondaks_portal/httpd/docs/k2test/index.php3</b> on line <b>34</b><br libhpi.so is in the library path... Here is my configuration now: [Java] java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar java.home=/home/local/java/jdk1.2.2 java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/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/green_threads java.library=/home/local/java/jdk1.2.2/jre/lib/i386/libjava.so extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214 extension=libphp_java.so Fraser On Fri, 19 Jan 2001, Alex Akilov wrote: > 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 > >

« previous php.general (#35660) next »