Chris Chabothas posted a PHP package he's worked up that functions as a daemon sitting and listening on a socket.

To deal with 1000's of concurrent, always on (comet aka hanging iframe) http (server) connections, and an equal amount of IRC client connections, plus being able to interpret and parse and delegate all the messages and events, i needed a very fast, stable, flexible and easy to use 'daemon' library for PHP.

He links to the tarball of the release and to the project page as well as including an example of its usage - creating a simple HTTP server with various hooks built in (like on_connect, on_read, and on_timer).