[英]php-fpm as service on Centos 7
php 7 built from sources从源代码构建的 php 7
While trying在尝试的同时
systemctl enable php-fpm.service
get得到
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
While trying在尝试的同时
chkconfig --levels 235 php-fpm on
get the same log :)得到相同的日志:)
Update:更新:
Somehow I managed to start by chkconfig
, but i dont remember how.不知何故,我设法通过
chkconfig
开始,但我不记得是怎么做的。 After reinstall OS and using PHP 7.0.6-dev
.重新安装操作系统并使用
PHP 7.0.6-dev
。
Since you are compiling your own PHP the unit/service need to be created, you can do it via chkconfig as you did or you can try to follow some guidelines, which I would recomend:由于您正在编译自己的 PHP,因此需要创建单元/服务,您可以像以前一样通过 chkconfig 来完成,或者您可以尝试遵循一些指导方针,我建议:
https://www.howtoforge.com/tutorial/how-to-install-php-7-on-debian/ https://www.howtoforge.com/tutorial/how-to-install-php-7-on-debian/
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html
Example file from the first tutorial:第一个教程中的示例文件:
[Unit]
Description=The PHP 7 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php-7.0.3/var/run/php-fpm.pid
ExecStart=/opt/php-7.0.3/sbin/php-fpm --nodaemonize --fpm-config /opt/php-7.0.3/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target
I saw the updated you already solved the issue, but I'll leave it here since it can help more people!我看到更新你已经解决了这个问题,但我会把它留在这里,因为它可以帮助更多的人!
Now, as for php 7.3, I use such approach after build php:现在,对于 php 7.3,我在构建 php 后使用这样的方法:
1. cp /path-to-php-src/sapi/fpm/php-fpm.service /etc/systemd/system/php-fpm.service
2. systemctl enable php-fpm.service
Content of file is similar to answer of Renato Mefi文件内容类似于 Renato Mefi 的回答
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.