Unable to run PHP script under Tomcat

I am using Tomcat 6. I installed PHP and will try to get PHP to work inside Tomcat using PHP / JavaBridge. I deployed JavaBridge.war inside the Tomcat webapps directory. When running any PHP script, I will get this error below. Please help and I thank you for your help.

This is how I configure PHP:

./configure --with-mime-magic --with-config file-path = / USR / local / Zend / etc. --with-apxs2 = / USR / local / apache2 / bin / APXS --with-LibXML-DIR = / USR --with-Mhash = / USR / local --with-BZ2 = / USR --with-curl = / USR --with-Gettext = / USR --with-MySQL = / USR / local / MySQL --with-Mcrypt = / USR / local --enable-magic quotes --enable-BCMath --enable-calendar - enable-ftp --enable-sockets --enable-wddx --enable-mbstring --enable-zippers --enable-exif --with -d. = / USR --with-FreeType-DIR = / USR --with-JPEG-Dir = / USR --with-PNG-DIR = / USR --enable-G.D. native-TTF --enable-FastCGI --enable-strength-CGI-Redirection

Error messages from Tomcat as follows:

HTTP Status 500 -

Type of exception report

message

Description The server detected an internal error () that prevented it from executing this request.

exceptions

javax.servlet.ServletException: php.java.bridge.http.FCGIConnectException: could not connect to the php.java.servlet.fastcgi.FastCGIServlet.init (FastCGIServlet.java:133) org.apache.catalina.valves.ErrorReportValve. (ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:298) org.apache.coyote.http11.Http11AprProcessor.process (Http11AprProcessor.java:861) org.apachettote11 .Http11AprProtocol $ Http11ConnectionHandler.process (Http11AprProtocol.java<79) org.apache.tomcat.util.net.AprEndpoint $ Worker.run (AprEndpoint.java:1584) java.lang.Thread.run (Thread.java:662) root cause

php.java.bridge.http.FCGIConnectException: could not connect to the php.java.bridge.http.SocketChannelFactory.test (SocketChannelFactory.java:58) php.java.servlet.fastcgi.FastCGIServlet.init (FastCGIServlet. ) org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:298) org.apache.coyote.http11.Http11AprProcessor.processor.processor.processor.p .java: 861) org.apache.coyote.http11.Http11AprProtocol $ Http11ConnectionHandler.process (Http11AprProtocol.java∗79) org.apache.tomcat.util.net.AprEndpoint $ Worker.run (AprEndpoint.java:1584) .Thread.run (Thread.java:662) root cause

java.io.IOException: java.net.ConnectException: connection rejected php.java.bridge.http.FCGIConnectException. (FCGIConnectException.java:37) php.java.bridge.http.SocketChannelFactory.test (SocketChannelFactory.java:58) php.java.servlet.fastcgi.FastCGIServlet.init (FastCGIServlet.java:131) org.apache.catalina.val .ErrorReportValve.invoke (ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:298) org.apache.coyote.http11.Http11AprProcessor.process (Http11AprProcessor.aporg.org .coyote.http11.Http11AprProtocol $ Http11ConnectionHandler.process (Http11AprProtocol.java<79) org.apache.tomcat.util.net.AprEndpoint $ Worker.run (AprEndpoint.java:1584) java.lang.Thread.run Thread : 662) root cause

java.io.IOException: PHP not found. Install php-cgi. The PHP test command was: [php-cgi, -v] php.java.bridge.Util $ Process.Start (Util.java:1145) php.java.servlet.fastcgi.FCGIProcess.start (FCGIProcess.java:68) php .java.bridge.http.SocketChannelFactory.doBind (SocketChannelFactory.java:125) php.java.bridge.http.FCGIConnectionFactory.runFcgi (FCGIConnectionFactory.java:88) php.java.bridge.http.FCGIConn 1.FCGIConn java: 109) note A full trace of the root cause stack is available in Apache Tomcat / 6.0.29 Logs.

Apache Tomcat / 6.0.29

+8
php tomcat php-java-bridge
source share
3 answers

I had the same error as you, a key point that you do not see here:

PHP CLI (command line interface) must be setup to work with java-php Bridge

as you claim to have installed PHP (any XAMPP / WAMP tools)

Complete the following steps:

  • Add PHP environment variable in PATH - Help
  • Confirm the configuration by running CMD>

    php-cgi -v 
  • In the above command, you will see PHP version information
  • Restart tomcat

PHP / JavaBridge should start working after this.

+2
source share

Reinstall and enable fastcgi so that it works for me!

0
source share

I had the same problem. Another suggestion was to add

 -Dphp.java.bridge.php_exec=/usr/bin/php 

on the command line. Instead, I changed the export of JAVA_OPTS to my catalina.sh file to add it. This did not work, but I combined it with the sentence above and added

 -Dphp.java.bridge.php_exec=/usr/bin/php-cgi 

to catalina.sh . I dropped the server and connected to the server / JavaBridgeTemplate621 / and got the PHP / Java Bridge settings page.

0
source share

All Articles