我想为systemd创build一个单元文件,它将在服务器重启后自动启动PHP FPM。
这里是文件内容:
[Unit] Description=PHP 5.5.32 FPM [Service] User=deploy Group=deploy WorkingDirectory=/home/deploy ExecStartPre=/usr/local/bin/phpbrew use 5.5.32 ExecStart=/usr/local/bin/phpbrew fpm start [Install] WantedBy=multi-user.target
但是,当我试图启动服务通过runnint sudo systemctl start php55-fpm.service莫名其妙地不起作用。
这里是sudo systemctl status php55-fpm.service的输出
● php55-fpm.service - PHP 5.5.32 FPM Loaded: loaded (/usr/lib/systemd/system/php55-fpm.service; enabled; vendor preset: disabled) Active: inactive (dead) since Wed 2016-03-30 05:13:52 CDT; 3min 50s ago Process: 20444 ExecStart=/usr/local/bin/phpbrew fpm start (code=exited, status=0/SUCCESS) Process: 20441 ExecStartPre=/usr/local/bin/phpbrew use 5.5.32 (code=exited, status=0/SUCCESS) Main PID: 20444 (code=exited, status=0/SUCCESS) Mar 30 05:13:52 web1 phpbrew[20444]: sami - http://get.sensiolabs.org/sami.phar Mar 30 05:13:52 web1 phpbrew[20444]: phpcs - https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar Mar 30 05:13:52 web1 phpbrew[20444]: pdepend - http://static.pdepend.org/php/latest/pdepend.phar Mar 30 05:13:52 web1 phpbrew[20444]: onion - https://raw.githubusercontent.com/phpbrew/Onion/master/onion Mar 30 05:13:52 web1 phpbrew[20444]: box-2.5 - https://github.com/box-project/box2/releases/download/2.5.2/box-2.5.2.phar Mar 30 05:13:52 web1 phpbrew[20444]: phpcov - https://phar.phpunit.de/phpcov.phar Mar 30 05:13:52 web1 phpbrew[20444]: phpcpd - https://phar.phpunit.de/phpcpd.phar Mar 30 05:13:52 web1 phpbrew[20444]: phpdcd - https://phar.phpunit.de/phpdcd.phar Mar 30 05:13:52 web1 phpbrew[20444]: phptok - https://phar.phpunit.de/phptok.phar Mar 30 05:13:52 web1 phpbrew[20444]: phploc - https://phar.phpunit.de/phploc.phar
附加信息:
SELinux被禁用
[root@web1 deploy]# sestatus SELinux status: disabled
有什么我错过了吗?
谢谢!
phpbrew 1.22.0现在支持fpm setup --systemctl命令来帮助您设置服务。
build立你的php时,一定要启用--with-fpm-systemd 。