PHP 4 and Java
| From: | Troels Arvin | Date: | Thu, 09 Mar 2000 21:05:42 +0000 |
| Subject: | PHP 4 and Java | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-11819@lists.php.net to get a copy of this message | ||
Hello,
I installed PHP 4 for the first time today.
Apart from the PHP4 and Zend logos not appearing properly (unless Netscape's "view
image" facility is applied on the "broken image" symbol) on a phpinfo() page, base
PHP seems to work fine.
However, I haven't been able to get the Java extension working.
When I start Apache, the followin lines appear in the error log:
PHP Fatal error: Unable to load dynamic library '/usr/lib/apache/libphp_java.so' -
/usr/lib/apache/libphp_java.so: undefined symbol: JNI_CreateJavaVM in Unknown on line 0
PHP Fatal error: Unable to load dynamic library '/usr/lib/apache/libphp_java.so' -
/usr/lib/apache/libphp_java.so: undefined symbol: JNI_CreateJavaVM in Unknown on line 0
PHP Fatal error: Unable to load dynamic library '/usr/lib/apache/libphp_java.so' -
/usr/lib/apache/libphp_java.so: undefined symbol: JNI_CreateJavaVM in Unknown on line 0
[Thu Mar 9 21:21:57 2000] [notice] Apache/1.3.12 (Unix) (Red Hat/Linux) PHP/4.0b5-dev configured
-- resuming
normal operations
Apache starts OK, but without any information on Java support in the
output from a phpinfo() - except in a line saying:
Configure command: './configure' '--prefix=/usr'
'--libdir=/usr/lib/apache' '--with-apxs' '--enable-track-vars'
'--with-gd' '--with-ttf'
'--with-imap=/usr/include/imap' '--enable-trans-sid'
'--with-system-regex' '--with-wddx' '--with-zlib'
'--enable-memory-limit'
'--with-mysql=shared' '--enable-versioning'
'--with-java=/usr/local/jdk/' '--with-config-file-path=/etc/httpd'
Base system: Red Hat Linux 6.1 with official updates.
PHP-version: PHP 4 checked out from CVS a couple of hours ago.
JDKs tried: Blackdown 1.2.2 RC 4 and Sun's JDK 1.2.2. Both Java
environments normally run OK (with the simple stuff that I do in Java).
My php.ini:
java.library=/usr/local/jre/lib/i386/libjava.so
java.library.path=/usr/local/jre/lib/i386/classic:/usr/local/jre/lib/i386/native_threads:/usr/local/jre/lib/i386:/usr/lib/apache
java.class.path=/usr/local/jre/lib/rt.jar:/usr/local/jre/lib/i18n.jar:/usr/lib/apache/php_java.jar:/home/httpd/java
extension=libphp_java.so
I have tried inserting the following dirs in both LD_LIBRARY_PATH and
in /etc/ld.so.conf:
/usr/local/jre/lib/i386
/usr/local/jre/lib/i386/classic
/usr/local/jre/lib/i386/native_threads
("ldconfig" makes no complaints).
An strace on "httpd -X" yields lines like:
open("/usr/lib/apache/libphp_java.so", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0755, st_size=16042, ...}) = 0
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\22\0\000"..., 4096) = 4096
mmap(0, 14760, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0x40433000
mprotect(0x40436000, 2472, PROT_NONE) = 0
mmap(0x40436000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 0x2000) = 0x40436000
close(4) = 0
munmap(0x40433000, 14760) = 0
write(2, "PHP Fatal error: Unable to load"..., 171) = 171
write(2, "\n", 1) = 1
(if this is of use to anyone)
A "ldd /usr/lib/apache/libphp_java.so" yields:
libc.so.6 => /lib/libc.so.6 (0x4000a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
--
Greetings from Troels Arvin, Copenhagen, Denmark