0

I used the Stack Overflow question "Run a PHP App Using Tomcat" to try to run PHP on Tomcat 6 under GNU/Linux. I get the following exceptions messages:

Exception 1:

java.lang.UnsatisfiedLinkError: no libphp5.so in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at net.php.reflect.loadLibrary(reflect.java:34)
at net.php.reflect.<clinit>(reflect.java:29)
at net.php.servlet.init(servlet.java:157)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:791)
at    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:127)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:581)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)

Exception 2:

java.lang.UnsatisfiedLinkError: net.php.servlet.send(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Z)V
at net.php.servlet.send(Native Method)
at net.php.servlet.service(servlet.java:190)
at net.php.servlet.service(servlet.java:214)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:581)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Unknown Source)

I have an entry for libphp5.so in the .properties file. I also have the libphp5.so file in java.library.path. Everything is built on and running on a 32-bit operating system. I have also copied the phpsrvlt.jar and php_java.jar files into the tomcat/common/lib directory.

Community
  • 1
  • 1
paresh
  • 1
  • 3
  • @Sean please don't do that. That isn't fixing the formatting. I have reverted the edit. If you actually read it, they are two different exceptions – Cole Tobin Feb 06 '13 at 16:21
  • Now, on the question: we won't want to help you unless you at least show some effort on trying to understand the exception. – Cole Tobin Feb 06 '13 at 16:22
  • Please don't do what? Make it easier to read the errors? – SeanWM Feb 06 '13 at 16:24
  • @Sean you removed a block of text... – Cole Tobin Feb 06 '13 at 16:26
  • @Sean sorry. My mistake. You formatted the block but the display cuts it off after a few tens of lines. But that edit should have corrected the post more as I did. – Cole Tobin Feb 06 '13 at 16:36
  • Long comment: What GNU/Linux distro (and version) did you compile for and what one are you attempting to run on? Keep in mind that different kernel versions havedifferent functions. The [kernel](http://kernel.org) is backwards compatible _the the way_ to _1.0_, but newer versions add new features. If you compile against a newer kernel version that you run on, your program won't run if it depends on functions defined in newer Unix standards that the Unix standard you run against. (The kernel is based loosely around the Unix standard) – Cole Tobin Feb 06 '13 at 16:39

1 Answers1

1

most likely library libphp5.so is missing in your linux OS. Try to find it, if you succeed check whether the directory is among dirs where system is looking for libraries (e.g. environtmet variable LD_LIBRARY_PATH) (most likely it is not). If everything is ok, then the error is really somewhere in tomcat initialization.

Anyway,the error says the system is unable to find libphp5.so

xhudik
  • 2,414
  • 1
  • 21
  • 39
  • The first exception says that it is unable to find the library in java.library.path. However, I copied the libphp5.so file manually into /lib which is one of the paths among the paths contained in java.library.path. It is still unable to find. BTW, I am getting the java.library.path on my system using java code System.getProperty("java.library.path"); I also tried setting the LD_LIBRARY_PATH to point to the directory containing the library but no luck. – paresh Feb 06 '13 at 17:11
  • oh man, copying libraries by hand - where did you see it? :P You have to install it, or compile it and install it by "make install" command. Sorry, it seems you are trying to manage something bigger than you ... Look here: http://stackoverflow.com/questions/5484047/libphp5-so-missing – xhudik Feb 06 '13 at 17:18