Q:

Appropriate linux directory to install php daemons

We have an application that uses daemons developed in php. Up until now, we had it running within the document root. But we've now isolated our daemon code from the main web application, so it is no longer needed in the document root. What is the appropriate directory to install such an application at?

A:

In addition to Ignacio Vazquez-Abrams answer (/srv if placed by the sysadmin, /usr/share/<appname> if packaged up.), you can start your PHP scripts with a shebang line like so:
#!/usr/bin/php
<?php
    ...
?>

Now you can make the file executable and put it in /usr/bin (binaries installed by package manager), /usr/local/bin (binaries installed by sysadmin), or any other place that binaries usually go.
Don't forget to add init scripts under /etc/init.d so you can start your daemon automatically on server boot!

A:

Under /srv if placed by the sysadmin, in /usr/share/<appname> if packaged up.

