php and java integration linux
| From: | user at domain dot invalid | Date: | Mon, 17 Mar 2003 20:03:42 +0000 |
| Subject: | php and java integration linux | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-10353@lists.php.net to get a copy of this message | ||
After battleling for several days with this issue I finally reached a (dirty) solution. Maybe someone can shed some light on this issue.(is every step needed?? It works now finally but...)
I'm using: apache 1.3.27 - php 4.2.3 - mysql 3.23.52 - RedHat8 - JavaSDK 1.3.1_06.
WHat I had to do to get java work with php is:
1) in /etc/ld.so.conf add:
/usr/local/java/jre/lib/i386
/usr/local/java/jre/lib/i386/server
2) in /etc/init.d/httpd add:
LD_LIBRARY_PATH=:/usr/local/java/jre/lib/i386:/usr/local/java/jre/lib/i386/server
3)while configuring PHP add:
--with-php=/usr/local/java
4) in usr/local/lib/php.ini add:
[java]
java.home=/usr/local/java
java.class.path=/usr/local/lib/php/php_java.jar
java.library=/usr/local/java/jre/lib/i386/libjava.so
extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20020429
extension=java.so
5) in the extension_dir of 4) do:
ln -s java.so libphp_java.so
*) The php-file that I use to check if it's working is:
<?php
$systemInfo = new Java("java.lang.System");
print "Total seconds since January 1, 1970:
".$systemInfo->currentTimeMillis();
?>
!!!! After all these steps if I would start apache and open this file I would get the following error:
Fatal error: Unable to load Java Library /usr/local/java/jre/lib/i386/libjava.so, error: libverify.so: cannot open shared object file: No such file or directory in /web/htdocs/htdocs/java.php on line 5
6) The solution is that I open a console, type:
export LD_LIBRARY_PATH=/usr/local/java/jre/lib/i386
and after that start apache like:
/usr/local/apache/1.3.27/bin/apachectl start
-> the result is:
Total seconds since January 1, 1970: 1.047930944E+12 /* The version of Java running is1.3.1_06*/
---> this 'joke' cost me lots of time (and frustration). The offical README's suggest that some of these steps are not needed. So what went wrong???
ANyone suggestions???
Thnx,
MrB