2

I'm working on MAMP server normally for php and I have htdocs folder on Users/myusername/Documents/ folder and to now because I want to work with javabridge library to execute java code through php files I installed Tomcat server and I put the folder directly on myusername folder on my mac and I installed javabridge but when I'm trying to open it through browser the following error is appeared about "install php-cgi" The problem in enable php-cgi on my mac through tomcat I tried a lot with all resources and solution in internet without any result!

type Exception report

message php.java.bridge.http.FCGIConnectException: Could not connect to server

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: php.java.bridge.http.FCGIConnectException: Could not connect to server
php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:133)
        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
root cause

php.java.bridge.http.FCGIConnectException: Could not connect to server
php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58)
php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)



  root cause

 java.io.IOException: java.net.ConnectException: Connection refused
php.java.bridge.http.FCGIConnectException.<init>(FCGIConnectException.java:37)
php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58)
php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
root cause

java.io.IOException: PHP not found. Please install php-cgi. 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.FCGIConnectionFactory$1.run(FCGIConnectionFactory.java:109)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.75 logs.
Samah Ahmed
  • 419
  • 8
  • 24
  • Can you clarify what you've already tested ? Have you a php-cgi script installed and is there a reference to it in the web.xml file (the web.xml indicates where the php-cgi executable can be found on your system, i.e. /usr/bin/php-cgi) ? – Sébastien Vanvelthem Feb 06 '17 at 17:23
  • @SébastienVanvelthem After installed JavaBridge inside Tomcat directory , I tried to open through browser http://localhost:8080/JavaBridge/ to ensure it's working or not but in this case the previous error is apperaed to me and when I'm seraching about it it's related to the php-cgi , I don't know how I can activate it through tomcat because the following folder /Users/myuser/tomcat/webapps/JavaBridge/WEB-INF/cgi/x86_64-mac contains two empty folder conf.d , ext and launcher.sh file and one text file told "You can add "php-cgi" to this directory and re-deploy your web application." how I can – Samah Ahmed Feb 06 '17 at 20:34
  • It's not required to put the php-cgi executable into the war file... The bridge can use the system one instead. Don't know about Mac, but I guess you can search from how to install php-cgi with brew on google. Once done you should be able to type 'php-cgi --version' or 'php --version' in a terminal. That way the bridge server should be able to use it (unless defined otherwise in web.xml - i.e. *prefer_system_php_exec if off*). – Sébastien Vanvelthem Feb 07 '17 at 11:29
  • You can read some infos about the [web.xml](https://github.com/belgattitude/soluble-japha/blob/master/doc/install_server.md#notes-about-webxml-configuration) file. Note that you might have better experience using the [soluble-japha](https://github.com/belgattitude/soluble-japha) refactored client, see the [install notes](https://github.com/belgattitude/soluble-japha/blob/master/doc/quick_install.md). – Sébastien Vanvelthem Feb 07 '17 at 11:32
  • @SébastienVanvelthem I tested that already on my mac before this post and the php is found on my mac but I can not run php-cgi when I'm testing php/java bridge and without it I can not make anything ! – Samah Ahmed Feb 09 '17 at 18:46
  • @SébastienVanvelthem I used this post to solve my problem and it's working now , the solution in the last comment http://stackoverflow.com/questions/27232483/how-to-install-php-cgi-as-a-plugin-in-mac-os-os-x-10-10 – Samah Ahmed Feb 09 '17 at 18:59

0 Answers0