I am trying to install PHP/Java bridge on my MacOS (10.12.6 - Sierra). I
downloaded and installed the latest version (7.1.3) as the Tomcat
application. Because Mac’s PHP does not provide pgp-cgi, I am using the PHP
from MAMP:
MBP-Robert-2:bin Robert$ *pwd*
/Users/Robert/Developer/Servers/apache-tomcat-8.5.11/bin
MBP-Robert-2:bin Robert$ *which php-cgi*
/Applications/MAMP/bin/php/php7.1.8/bin/php-cgi
MBP-Robert-2:bin Robert$ *php-cgi -v*
*PHP 7.1.8 (cgi-fcgi)* (built: Aug 17 2017 11:34:58)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
PhpCGIServlet is configured to use the system PHP (e.g. MAMP PHP):
<servlet>
<servlet-name>PhpCGIServlet</servlet-name>
<servlet-class>php.java.servlet.fastcgi.FastCGIServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<init-param>
<param-name>*prefer_system_php_exec*</param-name>
<param-value>*On*</param-value>
</init-param>
<init-param>
<param-name>php_include_java</param-name>
<param-value>Off</param-value>
</init-param>
</servlet>
I can run the bridge via standalone Apache or directly from PhpStorm, however,
when I try to run the PHP code using the CGI Servlet, I get the error
php.java.fastcgi.ConnectionException: Could not connect to server. Please
start it with: cd
/Users/Robert/Developer/Servers/apache-tomcat-8.5.11/webapps/phpbridge/WEB-INF/cgi/x86_64-mac
REDIRECT_STATUS=200 X_JAVABRIDGE_OVERRIDE_HOSTS=“/"
PHP_FCGI_CHILDREN="5" PHP_FCGI_MAX_REQUESTS="500" *php-cgi -b
127.0.0.1:9668 <http://127.0.0.1:9668>*
with root cause
java.net.ConnectException: Connection refused (Connection refused)
java.net.PlainSocketImpl.socketConnect(Native Method)
Checking the running processes I see the php-cgi is running and
listening on the port 9968
MBP-Robert-2:WEB-INF Robert$ ps -ef
501 10052 10051 0 3:04PM ?? 0:00.03
/Applications/MAMP/bin/php/php7.1.8/bin/php-cgi -b 127.0.0.1:9668 . .
.
and I do not assume the reason for this error is missing CGI
interface. For me is a bit confusing why the servlet advices to run
the php-cgi from the *WEB-INF/cgi/**x86_64-mac* when configured to run
system wide php-cgi executable.
Any idea what’s wrong?
Robert
* Robert Carnecky*
Neopsis GmbH
Sustenweg 9
CH-6020 Emmenbruecke
Switzerland
Tel. (+)41-41-262 0230
Fax (+)41-41-262 0231
Mobile (+)41-79-457 9776
Mail ro...@ne...
|