<?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>Mon, 05 Jan 2009 19:21:08 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Evert Pot's Blog: Forking and MySQL connections]]></title>
      <guid>http://www.phpdeveloper.org/news/11497</guid>
      <link>http://www.phpdeveloper.org/news/11497</link>
      <description><![CDATA[<p>
<i>Evert Pot</i> has a <a href="http://www.rooftopsolutions.nl/article/213">quick post</a> showing how you can make your code fork MySQL connections for better performance.
</p>
<blockquote>
For some of our long-running processes we use PHP. It makes total sense from our perspective, because we can re-use all our existing business logic from our main PHP web application. To make things more efficient, I recently started some work on using forks and have a couple of worker processes around.
</blockquote>
<p>
His sample script makes use of the <a href="http://php.net/pcntl_fork">pcntl_fork</a> and <a href="http://php.net/pcntl_wait">pcntl_wait</a> functions in PHP to spawn off processes that will be closed off when no longer needed.
</p>]]></description>
      <pubDate>Wed, 03 Dec 2008 12:07:32 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[WorkingSoftware.com.au: Something Like Threading- PHP Process Forking & Interprocess Communication]]></title>
      <guid>http://www.phpdeveloper.org/news/7999</guid>
      <link>http://www.phpdeveloper.org/news/7999</link>
      <description><![CDATA[<p>
New from <i>Iain Dooley</i> on the Working Software website today is <a href="http://www.workingsoftware.com.au/index.php?h=WebLog&author_id=1&entry_id=61">his look at</a> working with threading in PHP including forking and communication between the processes.
</p>
<blockquote>
I recently wrote a little application that dumps a file across a forwarded port. [...] So when I first wrote it, I didn't know what I was doing and had never written socket code before, so it was a big procedural mess. Naturally I was keen to separate out my socket class into it's own package but this presented a problem: the controlling process needed to check the status but how could I decouple the process that instantiated the socket class from the socket code itself
</blockquote>
<p>
So, he <a href="http://www.workingsoftware.com.au/index.php?h=WebLog&author_id=1&entry_id=61">set about</a> working up his class, hitting a few barriers along the way:
</p>
<ul>
<li>Copy On Write issues with how PHP handles the variable for the forked process
<li>Interprocess Communication using Sockets using the socket_create_pair function
<li>a "Curious Interlude" about why you can share sockets between two processes
</ul>
<p>
There's <a href="http://www.workingsoftware.com.au/index.php?h=WebLog&author_id=1&entry_id=61">a example of it in action</a> - a setup with a child process that's all set to count up and respond back with the current number to the managing script.
</p>]]></description>
      <pubDate>Thu, 07 Jun 2007 10:21:00 -0500</pubDate>
    </item>
  </channel>
</rss>
