How to solve javaBridge error php.java.fastcgi.ConnectionException? - php

I am using tomcat8.5, apache2, php7.25 on ubuntu 18.04
I installed php on my computer and did other configurations and installed required libraries. In the first day it worked fine and I could run a php script properly on localhost.
But next day when I tried to run the same php file I got this error.
Type Exception Report
Message Could not connect to server. Please start it with: cd /home/dr3am/Documents/phphome/WEB-INF/cgi/amd64-linux
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
php.java.fastcgi.ConnectionException: Could not connect to server. Please start it with: cd /home/dr3am/Documents/phphome/WEB-INF/cgi/amd64-linux
REDIRECT_STATUS=200 X_JAVABRIDGE_OVERRIDE_HOSTS="/" PHP_FCGI_CHILDREN="5" PHP_FCGI_MAX_REQUESTS="500" php-cgi -b 127.0.0.1:9669
php.java.fastcgi.SocketFactory.test(SocketFactory.java:73)
php.java.fastcgi.FCGIFactory.startFCGIServer(FCGIFactory.java:99)
php.java.fastcgi.FCGIConnectionPool.createConnectionPool(FCGIConnectionPool.java:147)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:220)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:209)
php.java.servlet.fastcgi.FastCGIServlet.doExecute(FastCGIServlet.java:374)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:468)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:479)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause
java.net.ConnectException: Connection refused (Connection refused)
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
java.net.Socket.connect(Socket.java:607)
java.net.Socket.connect(Socket.java:556)
java.net.Socket.<init>(Socket.java:452)
java.net.Socket.<init>(Socket.java:262)
php.java.fastcgi.SocketFactory.test(SocketFactory.java:67)
php.java.fastcgi.FCGIFactory.startFCGIServer(FCGIFactory.java:99)
php.java.fastcgi.FCGIConnectionPool.createConnectionPool(FCGIConnectionPool.java:147)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:220)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:209)
php.java.servlet.fastcgi.FastCGIServlet.doExecute(FastCGIServlet.java:374)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:468)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:479)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.
I didn't change any configuration file or removed any required library. But suddenly I got this error. I looked for solutions but I found nothing related to my problem.
What is the reason for this and how to solve it?

Related

problem with Mysql Unknown error starting mysql and Unknown error starting apache

I have problem with all version of bitnami. When I shut down or restart my pc, WAMP can't connect with MySQL. I closed skype but still have the same problem. I also changed to XAMPP but the problem still there when I shut down. In the end, I revert to bitnami and I still have the same problem. I've watched all the troubleshooting video and do something like changing port to 3307 but I can't resolve this problem.
This is the message I get from bitnami:
Stderr:
Unknown error starting mysql
Starting Apache Web Server...
Exit code: 1
Stdout:
Stderr:
Unknown error starting apache
could you try this?
1.- Go to the control panel->Administrative Tools -> Services,
2.- find web Deployment Service and stop it.
3.- Start the apache server in bitnami
You can check if the port it's in use with the console,
1.- click the Start button,
2.- type cmd
3.- right-click “Command Prompt” when it shows up in the search results. Click “Run as administrator.”
When the console appears copy the next command:
netstat -ab

php command is not recognized in wamp

I'm working on websocket. I came across this article, and simply downloaded their file and try running it in my localhost.
https://www.sanwebe.com/2013/05/chat-using-websocket-php-socket
What I understand is, they want to sue local server's websocket server.
But I have problem in starting up the server. I'm using windows 10 with wamp 2.2. As I checked webscket is enabled in my php.ini's extention.
I followed this example to cmd the right path to start it but to no avail:
https://www.sanwebe.com/2013/05/chat-using-websocket-php-socket/comment-page-1#comment-5593
It says 'php.exe' is not recognized as an internal or external ...
I then searched online again, thus set the path to my php folder in the system's environment variable. The path is: C:\wamp\bin\php. Then I closed the cmd and relaunched. Nothing worked out. The same error shows up.
This is what I did on cmd:
1) cd C:\wamp\bin\php
2) php.exe -q C:\projects\myfolder\server.php
Please help me to connect to wamp server's websocket to run the example I've downloaded.In the console, the error shown is:
WebSocket connection to 'ws://localhost:9000/demo/server.php' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I found the answer from this site: http://rodrixar.blogspot.my/2011/07/how-to-run-php-sockets-in-wamp.html
I did the following,
1) open cmd
2) cd C:\wamp\bin\php\php5.6.19
3)php.exe -q C:\projects\mysite\server.php
4) Firewall open up and allow access for CLI
5) now connection made already..

java.io.IOException: PHP FastCGI server not running

I configured piwik php code to my apache tomcat server using java-bridge and php-servlet api,
It is working fine for the local environment with window, but while same thing done on test environment, There also working fine but after some time it is falling and giving following exception :
If anyone having the same experience please help me to get it out.
type Exception report
message PHP FastCGI server not running. Please see server log for details. Or start a PHP FastCGI server using the command:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.io.IOException: PHP FastCGI server not running. Please see server log for details. Or start a PHP FastCGI server using the command:
cd /liferay-portal-6.2-ee-sp7/tomcat-7.0.42/webapps/piwik/WEB-INF/cgi/amd64-linux
REDIRECT_STATUS=200 X_JAVABRIDGE_OVERRIDE_HOSTS="/" PHP_FCGI_CHILDREN="5" PHP_FCGI_MAX_REQUESTS="5000" /usr/bin/php-cgi -b 127.0.0.1:9668
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:489)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:521)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126)
root cause
java.io.IOException: PHP FastCGI server failed:
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:439)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:481)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:521)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126)
root cause
php.java.bridge.http.FCGIConnectException: Could not connect to server
php.java.bridge.http.SocketChannelFactory.doConnect(SocketChannelFactory.java:77)
php.java.bridge.http.SocketChannelFactory.connect(SocketChannelFactory.java:88)
php.java.servlet.ContextLoaderListener$1.connect(ContextLoaderListener.java:533)
php.java.bridge.http.FCGIConnectionPool$Connection.reopen(FCGIConnectionPool.java:101)
php.java.bridge.http.FCGIConnectionPool.openConnection(FCGIConnectionPool.java:224)
php.java.servlet.fastcgi.FastCGIServlet.parseBody(FastCGIServlet.java:312)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:433)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:481)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:521)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126)
root cause
java.net.ConnectException: Connection refused
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
java.net.Socket.connect(Socket.java:579)
java.net.Socket.connect(Socket.java:528)
java.net.Socket.<init>(Socket.java:425)
java.net.Socket.<init>(Socket.java:241)
php.java.bridge.http.SocketChannelFactory.doConnect(SocketChannelFactory.java:75)
php.java.bridge.http.SocketChannelFactory.connect(SocketChannelFactory.java:88)
php.java.servlet.ContextLoaderListener$1.connect(ContextLoaderListener.java:533)
php.java.bridge.http.FCGIConnectionPool$Connection.reopen(FCGIConnectionPool.java:101)
php.java.bridge.http.FCGIConnectionPool.openConnection(FCGIConnectionPool.java:224)
php.java.servlet.fastcgi.FastCGIServlet.parseBody(FastCGIServlet.java:312)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:433)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:481)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:521)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
Apache Tomcat/7.0.42
Thanks!
Surendra

How to deploy Laravel 5.1 application to CentOS 6.4 VPS (or any!) server (PHP 5.5.32)

I have a Laravel 5.1 application that I'm trying to deploy on my CentOS 6.4 VPS server. The problem is that I am getting Error 500 when trying to load the page. When I check the error log it shows me this:
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/pams/pams_todo_list/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /home/pams/pams_todo_list/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87
I have changed the permissions in pams_todo_list/storage and pams_todo_list/vendors to 777 instead of 755 as a test, but no love.
This problem has been solved, thanks to FFForever and lagbox on the Laravel IRC channel.
My owner permissions were wrong. I had inadvertently uploaded the project using the root account. The fix was two fold. First, I setup suPHP as my php handler (I do have root access to this server) through the EasyApache3 UI in WHM. Then I set the owner:
chown -R pams:pams pams_todo_list
Now it works. I cannot say if it would have worked without setting up suPHP, however it was strongly recommended to set that up, so I did.

Neo4J: test from php cmd line works but web doesn't?

Using the following bits:
<?php
require('vendor/autoload.php');
$client = new Everyman\Neo4j\Client('localhost', 7474);
print_r($client->getServerInfo());
?>
If I run this as php test.php I get the expected output.
If I run this via http://server/test.php I get connection errors.
[24-Jun-2014 05:49:52] PHP Fatal error: Uncaught exception 'Everyman\Neo4j\Exception'
with message 'Can't open connection to http://localhost:7474/db/data/' in
/var/www/html/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport/Curl.php:91
Clearly I've monkeyed up something with either my PHP config or the installation of this library. Suggestions on where to look?
Installed per these instructions.
Running on CentOS 6.4 (x64), PHP 5.3.3
NOTE: I've made successful connections from other machines back to this server so I know the neo4j server is working. It just doesn't seem to want to let me connect locally when called via browser.
I had same issue, it was caused by SeLinux
Try disabling it by:
echo 0 >/selinux/enforce
then recheck connection.
If solved configure SeLinux permissions.
In my case httpd_can_network_connect should be on
setsebool -P httpd_can_network_connect on
echo 1 >/selinux/enforce
Helpful manual:
http://wiki.centos.org/TipsAndTricks/SelinuxBooleans

Categories