Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Dec 2003 16:15:10 +0100
From:      Matthew Whittaker-Williams <m.whittaker-williams@iu.nl>
To:        freebsd-java@freebsd.org
Cc:        m.whittaker-williams@iu.nl
Subject:   jdk1.3.1 with php4/apache1.3.x
Message-ID:  <20031221151510.GA38275@iu.nl>

next in thread | raw e-mail | index | archive | help
Good day fokes,

I got several questions relating to installing java under php4 build
with apache1.3.29.
I am trying to get java to work under php, but somehow it keeps nagging
about some Undefined Symbol:

Fatal error: Unable to load Java Library
/usr/local/jdk1.3.1/jre/lib/i386/libjava.so, error:
/usr/local/jdk1.3.1/jre/lib/i386/libjava.so: Undefined symbol
"JVM_DoPrivileged" in /home/www.bobshop.nl/wwwroot/javatest.php on line
10

This is the script i use to test java inside php:

<?php
  $system = new Java("java.lang.System");
  print "Java version=".$system->getProperty("java.version")." <br>\n";
  print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
  print "OS=".$system->getProperty("os.name")." ".
              $system->getProperty("os.version")." on ".
              $system->getProperty("os.arch")." <br>\n";
  $formatter = new Java("java.text.SimpleDateFormat","EEEE,
        MMMM dd, yyyy 'at' h:mm:ss a zzzz");
  print $formatter->format(new Java("java.util.Date"))."\n";
?>

As you see these are small request to the java system tho java borks on
it.

I took the following steps to try and get it working:

1) Compiled jdk1.3.1 from /usr/port/java/jdk13
2) Compiled apache13-modssl with LD_FLAGS="-phthread -lc_r"
3) Compiled www/modphp4 with --with-java=/usr/local/jdk1.3.1

Did a the following export before compiling to be sure it takes the
green_threads.
export THREADS_FLAG=green

4) set extra ldconfig_paths in rc.conf:

ldconfig_paths="/usr/lib/compat /usr/X11R6/lib /usr/local/lib
/usr/local/jdk1.3.1/jre/lib/i386"

gave the server a reboot

5) set the following paths in shell enviroment:

export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib:/usr/local/lib/php:/usr/local/lib/php/20020429:/usr/local/jdk1.3.1/jre/lib:/usr/local/jdk1.3.1/jre/lib/i386:/usr/local/jdk1.3.1/i386/green_threads

6) Linked java.so to libphp_java.so

cd /usr/local/lib/php/20020429 ; ln -s java.so libphp_java.so

7) checked the libraries:

ldd /usr/local/lib/php/20020429/libphp_java.so:

/usr/local/lib/php/20020429/libphp_java.so:
        libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x28109000)
        libssl.so.3 => /usr/lib/libssl.so.3 (0x28207000)

8) set the java class paths etc in php.ini:

[java]
java.class.path =
/usr/local/lib/php/php_java.jar:/usr/local/jdk1.3.1/jre/lib/rt.jar
/usr/local/lib/php/php_java.jar:/usr/local/jdk1.3.1/jre/lib/rt.jar
java.home = /usr/local/jdk1.3.1
java.library = /usr/local/jdk1.3.1/jre/lib/i386/libjava.so
java.library.path =
/usr/local/lib/php/20020429:/usr/local/jdk1.3.1/bin:/usr/local/jdk1.3.1/i386/green_threads:/usr/local/jdk1.3.1/i386/native_threads:/usr/local/jdk1.3.1/lib:/usr/local/jdk1.3.1/lib/i386:/usr/local/jdk1.3.1/jre:/usr/local/jdk1.3.1/jre/i386:/usr/local/jdk1.3.1/jre/i386/classic:/usr/local/jdk1.3.1/jre/i386/green_threads:/usr/local/jdk1.3.1/jre/i386/native_threads:/usr/local/jdk1.3.1/jre/lib/i386
extension_dir=/usr/local/lib/php/20020429
extension=libphp_java.so

As you see here i put almost every path to the java.library path to be
sure it can find all libraries it needs, tho i am not sure if this can
cause the error.
I tried minimizing the path and error kept coming up.

9) started apache and it gives me the Undefined Symbol.

If i search on google on that Symbol it doesn`t get me far.

So i was wondering if any of u fokes got jdk1.3.1 or anyother jdk
version working with php under freebsd.
I saw some articles on building it under freebsd but they all lead me to
this error.

So i am kinda stuck at the moment.

Hope any of u can help me out to solve this issue.

With kind regards

Matthew Whittaker-Williams

--
Unix System Administrator

Internet Unie
Postbus 23667
1100 ED AMSTERDAM
Tel: 020 463 0506
Fax: 020 463 2146
Email: m.whittaker-williams@iu.nl
URL: http://iu.nl



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031221151510.GA38275>