[PHP] Fix mdbroker memory leak + incorrect number of workers bug

1. mdbroker leaked like a sieve. ```$this->waiting``` array did not release workers.
2. I ported the changes from the zguide2 repo which I did several month ago. mmi.service call some times responds with 404 because mdbroker does not manage the number of workers properly.