Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended way to manage persistent PHP script processes?

First off - hello, this is my first Stack Overflow question so I'll try my best to communicate properly.

The title of my question may be a bit ambiguous so let me expand upon it immediately:

I'm planning a project which involves taking data inputs from several "streaming" APIs, Twitter being one example. I've got a basic script coded up in PHP which runs indefinitely from the command line, taking input from the Twitter streaming API and doing very basic things with it.

My eventual objective is to have several such processes running (perhaps daemonized using the System Daemon PEAR class), and I would like to be able to manage them from some governing process (also a PHP script). By manage I mean basic operations such as stop/start and (most crucially) automatically restarting a process that crashes.

I would appreciate any pointers on how best to approach this process management angle. Again, apologies if this question is too expansive - tips on more tightly focused lines of enquiry would be appreciated if necessary. Thanks for reading and I look forward to your answers.

like image 639
BigglesZX Avatar asked Apr 09 '10 09:04

BigglesZX


1 Answers

I think the recommended way of having persistent processes is not doing it in PHP at all ;)

But here are some related questions, it looks like some of the feedback contains some good thoughts and experience in doing this.

  • Is it wise to use PHP for a daemon?

  • Run php script as daemon process (especially 2nd and 3rd answer)

  • PHP Daemon/worker environment

More in the search.

like image 116
Pekka Avatar answered Sep 20 '22 02:09

Pekka