PHP Classes

clsDaemonize: Create and manage daemon processes on Unix systems

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 53%Total: 1,829 All time: 2,152 This week: 571Up
Version License Categories
clsdaemonize 1.0GNU General Publi...Unix


This class is intended to automate the creation of system daemons proceses under Unix like operating systems or those with POSIX compliant API like Linux, OpenBSD, FreeBSD, Solaris, Mac OS X, etc...

It can fork a new process using the PHP pcntl extension and detach from the starting shell so it can exit without killing the daemon process.

It can maintain a file that stores the daemon process identifier to prevent that more than one copy of the daemon is started.

It also creates a log file to register the daemon activity.

It is also possible register PHP callback functions to handle different types of signals.

Innovation Award
PHP Programming Innovation award nominee
June 2004
Number 7
A daemon is what are usually called the programs that run on their own under Unix/Linux based systems.

Thy usually implement services of handling events that may occur any time. Examples of daemon services include network connection handlers, mail processors, print spoolers, etc..

This class provides a solution that simplifies the implementation common details of operation of daemons, like being able to detach from the shell process that started it and so not end even if the starting process exits, assure that only one copy of the same daemon is running, handle signals that request termination, etc..

Even though running daemon scripts is not the a common use of PHP, this class simplifies the development of new useful daemons that may enhance the value of many PHP applications.

Manuel Lemos
Picture of Daniel Andres Marjos
  Performance   Level  
Name: Daniel Andres Marjos is available for providing paid consulting. Contact Daniel Andres Marjos .
Classes: 13 packages by
Country: Argentina Argentina
Age: 53
All time rank: 261 in Argentina Argentina
Week rank: 280 Down3 in Argentina Argentina Down
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files  
File Role Description
Plain text file clsDaemonize.php Class Main Class file
Accessible without login Plain text file test_daemon.php Example Example Script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:2,152
This week:571Up
 User Ratings  
 All time