Excellent lead Matthias!

I put -client at the top of the list and java -version displays

java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

so now I'm running almost the same configuration as you..

Still don't work though! 🙁
It still times out in a browser calling up jver.php or other simple scripts..

Thanks anyway, maybe I'll ask Cobalt for some advice (Ha!)

    Does the jdk work on Cobalt? I know that Cobalt uses a MIPS architecture and I don't know of any jdk that comes compiled for MIPS. This might be the problem.

      Hi Charles

      I'm using the very recently released Sun Cobalt JDK 1.3.1 which is built to run on a i386 type architecture (the Cubes and earlier than RaQ3 servers are MIPS)

      I know i'm really close, does anyone know of a way to see whats going on while my webserver is toiling to serve me a PHP/Java page? I've checked out strace but can't get tell anything useful from it..

      I'd be thinking about giving up right now if I could.

        Hello Paul,

        before you give up, please check this:

        I've these lines in my /etc/ld.so.conf:
        ...
        /usr/local/jdk1.3.1/jre/lib/i386
        /usr/local/jdk1.3.1/jre/lib/i386/hotspot
        /usr/local/jdk1.3.1/jre/lib/i386/navtive_threads

        On my system it don't work without it!
        Don't forget to run ldconfig if you have changed ld.so.conf.

        Wish you much success,

        Matthias

          Thanks Matthias, good suggestion again!

          But after adding the paths to ld.so.conf and running ldconfig I'm still no further forward. If I run your little test script or jver.php the operation still times out in the browser.

          I make sure my environment variables are set correctly every time i restart httpd, do you think I'm missing something there?

          CLASSPATH=:.:/usr/java/jakarta-tomcat/lib/servlet.jar:/usr/interclient/interclient.jar:/usr/java/jdk/jre/lib/rt.jar

          LD_LIBRARY_PATH=/usr/local/lib/php/extensions/no-debug-non-zts-20001222:/usr/java/jdk/jre/lib/i386:/usr/java/jdk/jre/lib/i386/hotspot:/usr/java/jdk/jre/lib/i386/native_threads

          PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/java/jdk/bin:/usr/java/jdk/jre/bin

          and maybe you have a good idea on how to debug while my browser seems to be trying to do something?

          yours gratefully

          Paul

            Hi Paul,

            after reading your message i've an important question: Is it your aim to run php as a servlet with tomcat or do you run apache (or something else ) as webserver an php is a module of it and your php-scripts do something like $obj=new Java(...).

            If first: Since one week I try it too, it does not run yet, but i'm hopeful.

            if second: add some echo and flush commands to your script; comment out your "new Java()"-line and check what happens.

            Matthias

              2 months later

              Hello
              I am tring to Use PHP and Java.
              I wanna use all the Java classes from php.
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              I start searching on the web about this topic and found this page.
              I am using jdk1.3.1, apache1.3.20 and php4.0.6 on Redhat7.1

              I follow all the step written by Mr.Matthias
              and
              tried the example Mr.Matthias gave.
              As follow.

              <?php
              $system = new Java("java.lang.System");
              echo "Seconds since 01/01/1970: [".$system->currentTimeMillis()."]";
              flush();
              ?>

              and I get:

              Fatal error: java.lang.NoClassDefFoundError: net/php/reflect in
              /home/hello/java/time.php on line 2

              hope someone can help me

                hello,

                I wrote to ask for help.
                but after working for about 3 hours I manage to make it work...

                  a month later

                  But - what made it work???

                    6 months later

                    After many frustrating hrs it finally works. The key is to use the hotspot jvm rather than the classic jvm. The hotspot jvm is designed for better performance in executing java code. Not sure why the classic jvm didn't work for me but the hotspot jvm works fine

                    Here is my system:

                    mandrake8.0
                    apache1.3.19
                    php4.1.1
                    sun microsystems jdk1.3.0_02

                    here are the steps to make this work: (check the paths to make sure they are the same on your system)

                    ./configure --with-apxs --with-java ...other config options...

                    make
                    make install

                    LD_LIBRARY_PATH={PATH-TO-JDK}/jre/lib/i386/hotspot:{PATH-TO-JDK}/jre/lib/i386

                    export LD_LIBRARY_PATH

                    PATH=$PATH:{PATH-TO-JDK}
                    export PATH

                    CLASSPATH={PATH-TO-JDK}/jre/lib/rt.jar
                    export CLASSPATH

                    add this to /etc/ld.so.conf, you don't have to put this here, does the same thing as setting the LD_LIBRARY_PATH environment variable but you have to set LD_LIBRARY_PATH everytime you reboot if you don't put it in ld.so.conf

                    {PATH-TO-JDK}/jre/lib/i386/hotspot
                    {PATH-TO-JDK}/jre/lib/i386

                    [JAVA] of php.ini
                    java.class.path = /usr/local/lib/php/php_java.jar
                    java.home = /usr/java/jdk1.3.0_02
                    java.library = {PATH-TO-JDK}/jre/lib/i386/hotspot/libjvm.so
                    ;java.library.path =
                    extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20010901
                    extension=libphp_java.so

                    apachectl restart ...et voila!

                    email me if you have any questions. Good luck!

                      oops meant to post this at the end

                      After many frustrating hrs it finally works. The key is to use the hotspot jvm rather than the classic jvm. The hotspot jvm is designed for better performance in executing java code. Not sure why the classic jvm didn't work for me but the hotspot jvm works fine

                      mandrake8.0
                      apache1.3.19
                      php4.1.1
                      jdk1.3.0_02

                      ./configure --with-apxs --with-java ...other config options...

                      make
                      make install

                      LD_LIBRARY_PATH={PATH-TO-JDK}/jre/lib/i386/hotspot:{PATH-TO-JDK}/jre/lib/i386

                      export LD_LIBRARY_PATH

                      PATH=$PATH:{PATH-TO-JDK}
                      export PATH

                      CLASSPATH={PATH-TO-JDK}/jre/lib/rt.jar
                      export CLASSPATH

                      add this to /etc/ld.so.conf, you don't have to put this here, does the same thing as setting the LD_LIBRARY_PATH environment variable but you have to set LD_LIBRARY_PATH everytime you reboot if you don't put it in ld.so.conf

                      {PATH-TO-JDK}/jre/lib/i386/hotspot
                      {PATH-TO-JDK}/jre/lib/i386

                      [JAVA] of php.ini
                      java.class.path = /usr/local/lib/php/php_java.jar
                      java.home = /usr/java/jdk1.3.0_02
                      java.library = {PATH-TO-JDK}/jre/lib/i386/hotspot/libjvm.so
                      ;java.library.path =
                      extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20010901
                      extension=libphp_java.so

                      apachectl restart ...et voila!

                        Write a Reply...