[英]Multiple versions of PHP-FPM, installing and configuring...?
I should have asked here days ago - i've been trying to get multiple versions of PHP-FPM running under different virtual hosts.几天前我应该在这里问过 - 我一直在尝试让多个版本的 PHP-FPM 在不同的虚拟主机下运行。
System: Centos 7 w/ Centos Web Panel (CWP), PHP 5.6/7.0/7.1/7.2, Apache 2.4系统:Centos 7 w/ Centos Web Panel (CWP), PHP 5.6/7.0/7.1/7.2, Apache 2.4
I have my versions of PHP under /opt/alt/phpXX/usr
ie /opt/alt/php72/usr
我在
/opt/alt/phpXX/usr
下有我的 PHP 版本,即/opt/alt/php72/usr
Example virtual host contents (website runs under PHP7.2):-示例虚拟主机内容(网站在 PHP7.2 下运行):-
<Directory "/home/bbb/public_html">
AddHandler application/x-httpd-php72 .php
AllowOverride All
</Directory>
What i've tried so far is adding this to the virtual host...到目前为止我所尝试的是将它添加到虚拟主机中......
<IfModule proxy_fcgi_module>
<FilesMatch \.(phtml|php[0-9]*)$>
SetHandler proxy:unix:/opt/alt/php72/usr/var/run/php-fpm/bbb.sock|fcgi://bbb
</FilesMatch>
</IfModule>
But the PHP-FPM service running on the server is the default package installed via yum
(version 5.4.16).但是服务器上运行的PHP-FPM服务是通过
yum
(5.4.16版本)安装的默认包。 Its binary runs from /usr/sbin
and reads from /etc/php-fpm.d/xxx.conf
and /etc/php.ini
.它的二进制文件从
/usr/sbin
运行并从/etc/php-fpm.d/xxx.conf
和/etc/php.ini
读取。
Question..题..
How do I start/run the actual PHP-FPM executable located in the appropriate PHP installation ie /opt/alt/php72/usr/sbin/php-fpm
?如何启动/运行位于适当 PHP 安装中的实际 PHP-FPM 可执行文件,即
/opt/alt/php72/usr/sbin/php-fpm
?
Many thanks非常感谢
Think i've sorted it...wish I'd posted this question yesterday...you always figure it out right after posting...!我想我已经整理好了...希望我昨天发布了这个问题...你总是在发布后立即弄清楚......!
I basically set up my own systemd service pointing to the php-fpm executable, following this guide - https://scottlinux.com/2014/12/08/how-to-create-a-systemd-service-in-linux-centos-7/我基本上按照本指南设置了自己的指向 php-fpm 可执行文件的 systemd 服务 - https://scottlinux.com/2014/12/08/how-to-create-a-systemd-service-in-linux- centos-7/
I copied the contents of another php-fpm service on the system, created a new service in /usr/lib/systemd/system/php72-phpfpm.service
, and this is what I came up with...我复制了系统上另一个 php-fpm 服务的内容,在
/usr/lib/systemd/system/php72-phpfpm.service
创建了一个新服务,这就是我想出的......
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=simple
#PIDFile=/usr/local/cwp/php71/var/run/cwp-php-fpm.pid
ExecStart=/opt/alt/php72/usr/sbin/php-fpm --nodaemonize --fpm-config /opt/alt/php72/usr/etc/php-fpm.conf -R
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Then just start, enable, restart the service as normal with systemctl.然后只需使用systemctl正常启动,启用,重新启动服务。
Hope that helps others...希望对其他人有帮助...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.