ghedipunk / PHP-Websockets

A Websockets server written in PHP.
BSD 3-Clause "New" or "Revised" License
913 stars 375 forks source link

when i use nohup for connecting socket, it does not create connection with db. #66

Open vinita90 opened 8 years ago

vinita90 commented 8 years ago

how to create temporary connection?

In this connection, socket connectivity with the database remains stable and working fine. But in production as I can not put a local connection I need to make socket connection permanently so I am using following thing for permanent connection :

but in this condition socket does not make connection with database.

Problem – I need to hold persistent data on socket so that I can share with other devices. How can we achieve this.

Xaraknid commented 8 years ago

First you should have read the README.md file :

To use:

Do not place the files in your web server's document root -- 
they are not intended to be ran through a web browser or otherwise 
directly accessible to the world. They are intended to be ran through 
PHP's Command Line Interface (CLI).

This is for your own security. The only file needed in public_html are those for client the *.html files.

I'll assume you use mysql for DB. http://us.php.net/manual/en/book.mysqli.php Maybe your problem is you have misconfigured your DB connection. I do not think it's related with this library.

Also using -q is useless in cli mode as said : http://php.net/manual/en/features.commandline.options.php -q --no-header Quiet-mode. Suppress HTTP header output (CGI only).

I highly encouraged you to check your output file for errors. If you don't want to use the default nohup output file you can specify your own by doing this :

nohup php mypage.php > mypage.log