Click to See Complete Forum and Search --> : php as servlet


Anon
06-14-2001, 03:55 AM
Hello,

I need to work with some own java objects in php.

My first installation was suns jsdk1.3.1, apache1.3.20 and php4.0.5 with java
support on SUSE Linux 6.4. All worked fine, but it needs to much time to start
a new java engine every time i use $obj = new Java(...).

That's why i installed jakarta tomcat3.2.2. If i start tomcat and run tomcats
example-jsps and -servlets all works fine.

Now i tried to run php as a servlet under tomcat. First i configured php:

./configure --with-servlet --with-java
make

I got a phpsrvlt.jar in /usr/local/php/sapi/servlet and changed my CLASSPATH.
Next i changed my LD_LIBRARY_PATH to the location of libphp4.so and finaly
i matched tomcats web.xml and phps web.xml.

If i run tomcat and try to execute the php samples i get the following error:

Error: 500
Location: /examples/php/jinfo.php
Internal Servlet Error:

java.lang.UnsatisfiedLinkError: /usr/local/lib/libphp4.so: /usr/local/lib/libphp4.so: undefined symbol: alloc_globals_id
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1382)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1306)
at java.lang.Runtime.loadLibrary0(Runtime.java:749)
at java.lang.System.loadLibrary(System.java:820)
at net.php.reflect.loadLibrary(reflect.java:34)
at net.php.reflect.(reflect.java:29)
at net.php.servlet.init(servlet.java:131)
at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
at org.apache.tomcat.core.Handler.init(Handler.java:215)
at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
at org.apache.tomcat.core.Handler.service(Handler.java:254)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)

What can i do to solve my problem? Can anybody help me?

Anon
06-17-2001, 11:24 PM
The problem was an uncorrect CLASSPATH, LD_LIBRARY_PATH and some uncorrect settings in ld.so.conf. After changing the values of the environment settings it starts without these error message.

Anon
08-01-2001, 07:41 PM
Matthias,

I can't help with your problem, but thought I'd mention that I'm getting the same undefined symbol: alloc_globals_id error with Apache 2.0.16 and Tomcat 4.0 Build 5 without adding servlet and java support.

If running Apache 2, you apparently need to add the four lines at the end of conf/httpd.conf mentioned in apache2filter under php-4.0.6/sapi/apache2filter.

I found alloc_globals_id referenced within the zend.c module as a conditional include, but I'll have to noodle on it a bit to determine what to do about it.

Since we have the same difficulty, I'll let you know what I find and would appreciate your feedback in like fashion.

Phil Welch