Re: PHP, Java integration failed: Red Hat 7.1, JDK 1.4, Apache 1.3x
| From: | Basil Hussain | Date: | Fri, 28 Jun 2002 15:36:19 +0000 |
| Subject: | Re: PHP, Java integration failed: Red Hat 7.1, JDK 1.4, Apache 1.3x | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-85660@lists.php.net to get a copy of this message | ||
Hi,
I have the Java support working on the following setup:
* RedHat Linux 7.1 (kernel 2.4.9-31smp)
* Apache 1.3.19 (apache-1.3.19-5 RPM)
* Sun JDK 1.4.0 (j2sdk-1.4.0-fcs RPM)
* PHP 4.1.2 (semi-custom-built RPM)
I have PHP installed from RPM, but I actually compiled in Java support
myself. I used the excellent RPM packages from Troels Arvin
(http://rpms.arvin.dk/php/) as a base, patched the spec file to add in Java
support and rebuilt the packages.
I submitted a patch for the spec file to Troels, but he hasn't yet made a
php-java sub-package available yet, due to some problems I think he has
making it work for him. I don't know why, because it was working fine for me
as it was!
I think his problems stem from the fact he made this change to my additions
whilst amending for PHP 4.2.1:
%if %{WANT_java}
%post java
%EXTENSION_HANDLE java ON
%preun java
if [ "$1" = 0 ]; then
%EXTENSION_HANDLE java OFF
fi
%endif
[...]
%if %{WANT_java}
%files java
%defattr(-,root,root)
%{RPM_EXTENSION_DIR}/java.so
%{RPM_EXTENSION_DIR}/php_java.jar
%endif
Whereas I had this:
%if %{WANT_java}
%post java
%EXTENSION_HANDLE libphp_java ON
%preun java
if [ "$1" = 0 ]; then
%EXTENSION_HANDLE libphp_java OFF
fi
%endif
[...]
%if %{WANT_java}
%files java
%defattr(-,root,root)
%{RPM_EXTENSION_DIR}/libphp_java.so
%{RPM_EXTENSION_DIR}/php_java.jar
%endif
The compilation doesn't actually spit out a java.so file (I don't know why -
probably to avoid a possible name confilct with some JVM's modules).
So, if you grab his source RPM and spec files
(http://rpms.arvin.dk/php/source/), make the above changes, as well as
changing "WANT_java" to "1", you will probably get some working packages
once built.
The only other things I had to do weren't to do with compilation. Firstly, I
needed to add the following lines to /etc/ld.so.conf:
/usr/java/j2sdk1.4.0/jre/lib/i386
/usr/java/j2sdk1.4.0/jre/lib/i386/server
and run 'ldconfig' afterwards. Secondly, I added the following to
/etc/profile to add the Java binaries to the system path:
if ! echo $PATH | /bin/grep -q "/usr/java/j2sdk1.4.0/bin"; then
PATH="$PATH:/usr/java/j2sdk1.4.0/bin"
fi
Finally, I used the following settings in my php.ini file:
[java]
java.class.path="/usr/lib/php4/php_java.jar"
java.library.path="/usr/lib/php4"
Hope all this helps!
Regards,
Basil Hussain
---------------------------------------
Internet Developer, Kodak Weddings
E-Mail: basil.hussain@kodakweddings.com