Search code examples
phppear

PHP Pear system_daemon doesn't fork


Scripts written for pear's "system_daemon" refuse to fork off to form new process. This works well on my old server, but my new server is not having it. The daemon scripts run just fine in a shell and will run until I kill them. As a temporary workaround, I have the daemon running in a detached tmux shell, but this obviously isn't a long term solution.

Are there any known issues that prevent it from forking?

I have PHP 5

PHP 5.3.10-1ubuntu3.2 with Suhosin-Patch (cli) (built: Jun 13 2012 17:19:58) 

and pcntl listed here loaded ini's

/etc/php5/cli/conf.d/pcntl.ini,

and here further down in php -i output

pcntl

pcntl support => enabled

and Pear

PEAR Version: 1.9.4

and Pear's system_daemon

pear/System_Daemon                             1.0.0      1.0.0  Turn PHP scripts into Linux daemons

Any ideas what is going wrong here?

I can't post source, unfortunately, but I can say that all (including the examples in the documentation) system_daemon scripts refuse to fork.

Edit -- Additional details

As suggested by cweiske, I tried the pcntl example and it worked correctly

I also tried uninstall system_daemon, purging my pear installation with aptitude, restarting, re-installing pear, and re-installing system_daemon. This also had no effect.

I can duplicate this issue on other Ubuntu boxes 11.04+


Solution

  • Issue resolved.

    1) My appName property had an uppercase letter in it, which newer versions of system_daemon will complain about

    2) I had installed pear and system_daemon before install pcntl. From the source this didn't look like it could cause an issue, but I re-installed both to be safe.