2

I have been trying to integrate PHP in APACHE TOMCAT 6 by following second answer for the QUESTION RUN PHP APP IN TOMCAT 6. I am facing troubles with the configuration.

  1. First I got Exception java.lang.UnsatisfiedLinkError: no php5srvlt in java.library.path. which I resolved by placing php5srvlt.jar, generated in step 12, in tomcat\lib.

  2. After that I am facing

    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
    net.php.servlet.send(Native Method)
    net.php.servlet.service(servlet.java:190)
    net.php.servlet.service(servlet.java:214)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723) 
    

    Exception.

I tried to find solutions for this but could only get close to this QUESTION. But, I do not want to do the whole thing once again, because I have tried several times. I tried with TOMCAT 8.0.15, but failed. Now, just to go in sink with the instructions I have installed TOMCAT 6 and trying to integrate PHP.

I am placing log file for the request made for tomcat/webapps/PHP/test.php.

LOCALHOST.YYYY-MM-DD.log

Dec 29, 2014 12:15:46 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet php threw exception
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:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1778)
at java.lang.Thread.run(Thread.java:744)

TEST.PHP

<?php 
echo "HELLO WORLD";
?>

EDIT

I mistook that I was getting problem 1 because i did not have php5srvlt.jar in tomcat/lib. But, in fact, problem 1 appears when i request the page for the first time after starting the server. and later on I see problem 2.

I've learned from here that php and pecl version must be same, but still I get the same error even after working with same version numbers 5.2.5

Community
  • 1
  • 1
saikumarm
  • 1,565
  • 1
  • 15
  • 30

1 Answers1

1

The error message indicates that you're missing .dll-files necessary for such a .. fragile contraption.

The UnsatisfiedLinkError is thrown when an application attempts to load a native library like .so in Linux, .dll on Windows or .dylib in Mac and that library does not exist.

But please - reconsider what you're actually doing. There is (almost) no good reason for running a PHP context inside Tomcat.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • I am actually trying to run php files on my apache tomcat server to respond to ajax calls. Instead of getting an echo message back to responseText, I am getting entire file. Therefore, I thought I should have a php parser so that only the echo message will get back to me. If this is not a good way, How do I do it? – saikumarm Dec 29 '14 at 12:16
  • Run PHP in a suitable context, either using Apache and FCGI/mod_php, or nginx + php-fpm or other options. PHP is not written, nor tested, for running inside Tomcat. Use Tomcat as an application server for Java based applications, which is what it was made for. – MatsLindh Dec 29 '14 at 12:50