多个版本的PHP-FPM,正在安装和配置...? [英] Multiple versions of PHP-FPM, installing and configuring...?

查看:65
本文介绍了多个版本的PHP-FPM,正在安装和配置...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几天前应该在这里问过-我一直在尝试在不同的虚拟主机上运行多个版本的PHP-FPM.

I should have asked here days ago - i've been trying to get multiple versions of PHP-FPM running under different virtual hosts.

系统:带有Centos Web面板(CWP)的Centos 7,PHP 5.6/7.0/7.1/7.2,Apache 2.4

System: Centos 7 w/ Centos Web Panel (CWP), PHP 5.6/7.0/7.1/7.2, Apache 2.4

我在/opt/alt/phpXX/usr 下有我的PHP版本,即/opt/alt/php72/usr

I have my versions of PHP under /opt/alt/phpXX/usr i.e. /opt/alt/php72/usr

虚拟主机内容示例(网站在PHP7.2下运行):-

Example virtual host contents (website runs under 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>

但是服务器上运行的PHP-FPM服务是通过 yum (版本5.4.16)安装的默认软件包.它的二进制文件从/usr/sbin 运行,并从/etc/php-fpm.d/xxx.conf /etc/php.ini 读取>.

But the PHP-FPM service running on the server is the default package installed via yum (version 5.4.16). Its binary runs from /usr/sbin and reads from /etc/php-fpm.d/xxx.conf and /etc/php.ini.

问题..

如何启动/运行位于适当的PHP安装中的实际PHP-FPM可执行文件,即/opt/alt/php72/usr/sbin/php-fpm ?

How do I start/run the actual PHP-FPM executable located in the appropriate PHP installation i.e. /opt/alt/php72/usr/sbin/php-fpm?

非常感谢

推荐答案

认为我已经对它进行了排序...希望我昨天发布了这个问题...发布后您总是会发现它的问题...!

Think i've sorted it...wish I'd posted this question yesterday...you always figure it out right after posting...!

我基本上按照本指南设置了指向php-fpm可执行文件的系统服务- https://scottlinux.com/2014/12/08/how-to-create-a-systemd-service-in-linux-centos-7/

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服务的内容,在/usr/lib/systemd/system/php72-phpfpm.service 中创建了一个新服务,这就是我来的与...

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

[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

然后只需使用systemctl正常启动,启用和重新启动服务即可.

Then just start, enable, restart the service as normal with systemctl.

希望对别人有帮助...

Hope that helps others...

这篇关于多个版本的PHP-FPM,正在安装和配置...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆