<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 26 May 2013 03:21:47 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Simas Toleikis' Blog: Writing a PHP daemon application]]></title>
      <guid>http://www.phpdeveloper.org/news/15768</guid>
      <link>http://www.phpdeveloper.org/news/15768</link>
      <description><![CDATA[<p>
<i>Simas Toleikis</i> has a new post today looking at a method he's found for creating <a href="http://simas.posterous.com/writing-a-php-daemon-application">a simple daemon application</a> in PHP. He gives you the basic outline of how it works (with a bit of code included) but not a specific example.
</p>
<blockquote>
There is a special group of applications that require a different PHP script execution model. [...] All of [these special] applications need to be run in the background as daemons - something that PHP was never designed/supposed to be good at. The plain C language is a weapon of choice when it comes to writing a daemon implementation, but then again, if the application in question does not depend on high performance and concurrency - PHP can do the job quite well.
</blockquote>
<p>
He talks about using the command line interface to run the scripts, creating the while loop to keep execution going and creating the non-blocking socket so that the script can accept new client connections.  He also mentions using <a href="http://upstart.ubuntu.com/">upstart</a> to run the script in the background and the <a href="http://pecl.php.net/package/proctitle/">proctitle</a> PECL extension to give the process a custom name in the process list. He also touches on log files and forking/parallel processing.
</p>]]></description>
      <pubDate>Wed, 19 Jan 2011 11:51:34 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Mark Karpeles' Blog: proctitle: a new step for pinetd]]></title>
      <guid>http://www.phpdeveloper.org/news/11793</guid>
      <link>http://www.phpdeveloper.org/news/11793</link>
      <description><![CDATA[<p>
If you've ever worked with forking processes in PHP, you know things can get a little difficult when you have more than one process going at a time. Identification can become a hassle, especially if you need to kill one off because of performance issues. If you've found yourself in this spot before, you might want to check out <a href="http://blog.magicaltux.net/2009/01/21/proctitle-a-new-step-for-pinetd/">this update</a> <i>Mark Karpeles</i> has made to his <a href="http://www.pinetd.net/">pinetd</a> project to allow for naming of those forked processes.
</p>
<blockquote>
Ever wanted to give meaningful names to your processes when you pcntl_fork() with PHP ? proctitle is the extension you're looking for!
Adapted from <a href="http://bugs.php.net/29479">bug report #29479</a> and code initially wrote by <a href="http://en.wikipedia.org/wiki/User:Midom">Midom</a> for Wikipedia, the proctitle extension allows for a process to change its own displayed title in the system's process list.
</blockquote>
<p>
The extension (seen in action <a href="http://blog.magicaltux.net/wp-content/uploads/2009/01/viva_pinetd1.png">here</a>) is an interface for making different sorts of daemons, including the ability to give them names. You can check out the project <a href="http://ookoo.org/svn/proctitle/">here</a>.
</p>]]></description>
      <pubDate>Thu, 22 Jan 2009 11:12:17 -0600</pubDate>
    </item>
  </channel>
</rss>
