title: PHP Gearman Examples - the Missing Link?
body: <p>There is no dearth of examples showing how to use Gearman from PHP out there.  A typical one would go like this</p>
  
  <pre><code>**CLIENT**
  
  &lt;?php
    $client= new GearmanClient();
    $client-&gt;addServer();
    print $client-&gt;do("revit", "AlL THE World's a sTagE");
    print "\n";
  ?&gt;
  
  **SERVER**
  
  &lt;?php
     $worker= new GearmanWorker();
     $worker-&gt;addServer();
     $worker-&gt;addFunction("revit", "rev_it");
     while ($worker-&gt;work());
  
     function rev_it($job)
     {
        return strrev($job-&gt;workload());
     }
  ?&gt;
  </code></pre>
  
  <p>I installed Gearmand and the PECL PHP extension on my 64 bit CentOS server, wrote up these scripts, ensured that Gearmand was running and then browsed to the client. The browser waited... .  </p>
  
  <p>I had fully expected this since I figured that the Gearman server needs to somehow know that it should execute that particular worker script when it receives an appropriate client request.</p>
  
  <p>I opened another tab and browsed to the worker script and promptly got back a response in the client script tab.</p>
  
  <p>There appears to be a missing link here.  When one writes a worker script does it not somehow have to be registered with the Gearman server so the latter knows to use it to service certain clients?</p>
  
  <p>Either I have been Googling for the wrong things or else all those "How to use Gearman in PHP" examples leave out something.  Could someone here help?</p>