aximbigfan Posted August 23, 2008 Share Posted August 23, 2008 Hi, I have a PHP script that listens to connections to a socket it creates, then responds to them. This script needs to actually act as a server though, which means it must run in the background somehow, just like any other process would run in the background. Any ideas? Thanks, Chris Link to comment https://forums.phpfreaks.com/topic/120945-php-cli-as-daemon/ Share on other sites More sharing options...
DarkWater Posted August 23, 2008 Share Posted August 23, 2008 Did you even look on Google for PHP CLI server scripts? :-\ Link to comment https://forums.phpfreaks.com/topic/120945-php-cli-as-daemon/#findComment-623460 Share on other sites More sharing options...
ratcateme Posted August 23, 2008 Share Posted August 23, 2008 very bad idea i thought this would be a good idea but if you look at your CPU usage while the script is running you will see php runs at 100%(or as close to that as it can get) so your cpu will forever be at 100% for the rest of it's life (assuming you want to run it full time) Scott. Link to comment https://forums.phpfreaks.com/topic/120945-php-cli-as-daemon/#findComment-623461 Share on other sites More sharing options...
aximbigfan Posted August 23, 2008 Author Share Posted August 23, 2008 Did you even look on Google for PHP CLI server scripts? :-\ I did "PHP Deamon" and got no relevant results. Chris Link to comment https://forums.phpfreaks.com/topic/120945-php-cli-as-daemon/#findComment-623632 Share on other sites More sharing options...
trq Posted August 23, 2008 Share Posted August 23, 2008 So, what is the problem exactly? The & opertaor is used to put a job into the background on Linux. /usr/bin/phpserv & Though you would likely want to look at writting a startup script for the process and placing it within the /etc/init.d/ directory. Link to comment https://forums.phpfreaks.com/topic/120945-php-cli-as-daemon/#findComment-623686 Share on other sites More sharing options...
aximbigfan Posted August 24, 2008 Author Share Posted August 24, 2008 Hi Thrope, that's what I have been doing. I guess I'll just create a small app to launch the PHP app, then put a pointer to that in init.d Chris Link to comment https://forums.phpfreaks.com/topic/120945-php-cli-as-daemon/#findComment-624044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.