Appropriate linux directory to install php daemons
We have an application that uses dae开发者_如何学Pythonmons 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?
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!
Under /srv
if placed by the sysadmin, in /usr/share/<appname>
if packaged up.
It really depends on many factors, such as your distribution, administration policies, what is there already, etc. If you really do want a neutral directory for just those things that your environment needs, a lot of people use /opt.
精彩评论