title: Error in php/java bridge "PHP not found. Please install php-cgi" on mac
body: <p>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!  </p>
  
  <pre><code>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.&lt;init&gt;(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.
  </code></pre>