2016-03-16 63 views
2

來源PHP-FPM作爲服務在CentOS 7

內置PHP 7雖然試圖

systemctl enable php-fpm.service 

得到

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, ...). 

雖然試圖

chkconfig --levels 235 php-fpm on 

得到相同的日誌:)

更新:

不知何故,我設法開始chkconfig,但我不記得是如何。重新安裝操作系統並使用PHP 7.0.6-dev後。

+0

有關您的問題的任何更新?仍然需要幫助? –

回答

2

既然你自己編譯PHP單位/服務需要被創建,您可以通過chkconfig的做到這一點像你一樣,或者你可以試着遵循一些指導,我會建議:

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

示例文件:

[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 

只見更新你已經解決這個問題,但我會留在這裏,因爲它可以幫助更多的人!