niutech / node.php

Run node.js apps from PHP even on a shared hosting!
813 stars 236 forks source link

Connection refused #31

Closed RnD-Qrio closed 6 years ago

RnD-Qrio commented 7 years ago

My node js server setup with node-php stop working after few days. I got a success message

Starting: node 'myapp/server.js' Done. PID=... while calling http://myserver/node.php?start=myapp And my server was working properly.

But after few days it started to show an error message Error: Failed to connect to 127.0.0.1 port 24572: Connection refused

Then I tried to start the node app again but got this message Node.js is already running. Stop it.

While trying to stop it, got a messge Stopping Node.js with PID=: Error = 1.

RnD-Qrio commented 7 years ago

Now got this error while stopping my app Stopping Node.js with PID=xxxxxx: Failed. Error: 1

Zono4ever commented 7 years ago

Hi there,

if you see this error on you page

Error: Failed to connect to 127.0.0.1 port 24572: Connection refused

and you going to stop you running node.js you will see this log (or is tell err whatever).

Stopping Node.js with PID=xxxxxx: Failed. Error: 1

this is just a log to tell you that you node.js have a error while runing (maybe your ip is change or pid is kill or whatever...) and because of this error your node.js will auto stop running and that's why you see this on your page

Error: Failed to connect to 127.0.0.1 port 24572: Connection refused

Just ignore this error log and stop you node.js than start your node.js agains.

P/S: the best way is you must kill all pid before restart you node.js.

Here is my demo node php . I've configure my demo with foreverjs this help me to auto restart the node.js if crash or code is change.

Best regard...

niutech commented 6 years ago

In case of emergency, connect to your host using SSH or PHPShell and invoke killall node, change the port in node.php and start it.