PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

System_Daemon | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

System_Daemon

Because the Process Control Extensions' documentation is a bit rough, I decided to figure it out once, and then wrap my knowledge and the required code inside a PEAR class called: System_Daemon. And so now you can just:

System_Daemon Usage

<?php
    
require_once "System/Daemon.php";                 // Include the Class

    
System_Daemon::setOption("appName""mydaemon");  // Minimum configuration
    
System_Daemon::start();                           // Spawn Deamon!
?>

And that's all there is to it. The code after that, will run in your server's background. So next, if you create a while(true) loop around that code, the code will run indefinitely. Remember to build in a sleep(5) to ease up on system resources.

Features & Characteristics Here's a grab of System_Daemon's features:

  • Daemonize any PHP-CLI script

  • Simple syntax

  • Driver based Operating System detection

  • Unix only

  • Additional features for Debian / Ubuntu based systems like:

  • Automatically generate startup files (init.d)

  • Support for PEAR's Log package

  • Can run with PEAR (more elegance & functionality) or without PEAR (for standalone packages)

  • Default signal handlers, but optionally reroute signals to your own handlers.

  • Set options like max RAM usage

忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「System_Daemon」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | System_Daemon」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: