简体   繁体   中英

How to open remote server socket php?

I am developing chat application using php and ajax . later I found get messages by ajax after X seconds doesn't efficient. I want to develop it by php socket . I opened the local server socket by example :

php -f server.php 

My question is How can I open remote server socket after uploading files to the host, need to write commands ?

You can use same command in the remote server too if you have shell access to remote server. Otherwise you have to run it using its URL. If you have shell access and If you want it to run in background of the server just add && at the end like below in the terminal,

php -f server.php &&

But this will not run again automatically after server reboot or after script stopped. If you want to do so, you need to use daemon process for this. You can find information about daemon setup here

Run php script as daemon process

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM