<bdo id='CBN1c'></bdo><ul id='CBN1c'></ul>

      <tfoot id='CBN1c'></tfoot>
      1. <legend id='CBN1c'><style id='CBN1c'><dir id='CBN1c'><q id='CBN1c'></q></dir></style></legend>

      2. <i id='CBN1c'><tr id='CBN1c'><dt id='CBN1c'><q id='CBN1c'><span id='CBN1c'><b id='CBN1c'><form id='CBN1c'><ins id='CBN1c'></ins><ul id='CBN1c'></ul><sub id='CBN1c'></sub></form><legend id='CBN1c'></legend><bdo id='CBN1c'><pre id='CBN1c'><center id='CBN1c'></center></pre></bdo></b><th id='CBN1c'></th></span></q></dt></tr></i><div id='CBN1c'><tfoot id='CBN1c'></tfoot><dl id='CBN1c'><fieldset id='CBN1c'></fieldset></dl></div>

        <small id='CBN1c'></small><noframes id='CBN1c'>

      3. 在 CentOS 7 上使用 Apache 的多个 PHP 版本

        时间:2024-04-13

            <bdo id='pDDHB'></bdo><ul id='pDDHB'></ul>

              • <tfoot id='pDDHB'></tfoot>
              • <legend id='pDDHB'><style id='pDDHB'><dir id='pDDHB'><q id='pDDHB'></q></dir></style></legend>

                  <tbody id='pDDHB'></tbody>

                <small id='pDDHB'></small><noframes id='pDDHB'>

                <i id='pDDHB'><tr id='pDDHB'><dt id='pDDHB'><q id='pDDHB'><span id='pDDHB'><b id='pDDHB'><form id='pDDHB'><ins id='pDDHB'></ins><ul id='pDDHB'></ul><sub id='pDDHB'></sub></form><legend id='pDDHB'></legend><bdo id='pDDHB'><pre id='pDDHB'><center id='pDDHB'></center></pre></bdo></b><th id='pDDHB'></th></span></q></dt></tr></i><div id='pDDHB'><tfoot id='pDDHB'></tfoot><dl id='pDDHB'><fieldset id='pDDHB'></fieldset></dl></div>
                  本文介绍了在 CentOS 7 上使用 Apache 的多个 PHP 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  任何人都可以在这里指导我在 CentOS 7 上使用一个 apache 实例安装和配置 Multi PhP 的方法,以及测试它的正确方法..

                  Can anyone here instruct me way to install and configure Multi PhP with one apache instance on CentOS 7, and the proper way to test it..

                  推荐答案

                  安装所有必要的 repos 和包

                  非常感谢 https://rpms.remirepo.net/wizard/

                  以下命令假设您已经 sudo su - 或者您必须将 sudo 添加到每个命令:

                  install all the necessary repos and packages

                  big thanks to https://rpms.remirepo.net/wizard/

                  the following commands assume you already sudo su - or you will have to add sudo to each of the commands:

                  yum install httpd -y
                  yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
                  yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
                  yum install yum-utils -y
                  yum install php56 -y
                  yum install php72 -y
                  yum install php56-php-fpm -y
                  yum install php72-php-fpm -y
                  

                  停止两个 fpm 服务器

                  systemctl stop php56-php-fpm
                  systemctl stop php72-php-fpm
                  

                  默认监听 127.0.0.1 端口 9000,让它们监听不同的端口

                  sed -i 's/:9000/:9056/' /etc/opt/remi/php56/php-fpm.d/www.conf
                  sed -i 's/:9000/:9072/' /etc/opt/remi/php72/php-fpm.d/www.conf
                  

                  现在可以在不同的端口上启动两个不同版本的 fpm

                  systemctl start php72-php-fpm
                  systemctl start php56-php-fpm
                  

                  制作脚本包装器以调用 php56-cgi 和 php72-cgi

                  make script wrapper to call php56-cgi and php72-cgi

                  cat > /var/www/cgi-bin/php56.fcgi << EOF
                  #!/bin/bash
                  exec /bin/php56-cgi
                  EOF
                  
                  cat > /var/www/cgi-bin/php72.fcgi << EOF
                  #!/bin/bash
                  exec /bin/php72-cgi
                  EOF
                  

                  让它们被 apache 执行

                  sudo chmod 755 /var/www/cgi-bin/php56.fcgi
                  sudo chmod 755 /var/www/cgi-bin/php72.fcgi
                  

                  为 apache 创建 php 配置.默认情况下它运行 php56-fcgi 处理程序

                  cat > /etc/httpd/conf.d/php.conf << EOF
                  ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
                  AddHandler php56-fcgi .php
                  Action php56-fcgi /cgi-bin/php56.fcgi
                  Action php72-fcgi /cgi-bin/php72.fcgi
                  
                  <Directory /var/www/html/php56>
                      DirectoryIndex index.php
                      AllowOverride all
                      Require all granted
                  </Directory>
                  <Directory /var/www/html/php72>
                      DirectoryIndex index.php
                      AllowOverride all
                      Require all granted
                  </Directory>
                  EOF
                  

                  制作测试页面,创建.htaccess以使用php72-fcgi

                  mkdir -p /var/www/html/php56
                  mkdir -p /var/www/html/php72
                  echo "<?php phpinfo(); ?>" > /var/www/html/php56/index.php
                  echo "<?php phpinfo(); ?>" > /var/www/html/php72/index.php
                  echo "AddHandler php72-fcgi .php" > /var/www/html/php72/.htaccess
                  

                  现在你应该可以测试它了

                  (http://127.0.0.1/php56)
                  (http://127.0.0.1/php72)

                  sudo systemctl enable httpd
                  sudo systemctl enable php56-php-fpm
                  sudo systemctl enable php72-php-fpm
                  

                  这篇关于在 CentOS 7 上使用 Apache 的多个 PHP 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:shell_exec() 在“ls"上返回 null 下一篇:如何配置 php 以在 CentOS 上启用 pdo 并包含 mysqli?

                  相关文章

                  <i id='gkzMD'><tr id='gkzMD'><dt id='gkzMD'><q id='gkzMD'><span id='gkzMD'><b id='gkzMD'><form id='gkzMD'><ins id='gkzMD'></ins><ul id='gkzMD'></ul><sub id='gkzMD'></sub></form><legend id='gkzMD'></legend><bdo id='gkzMD'><pre id='gkzMD'><center id='gkzMD'></center></pre></bdo></b><th id='gkzMD'></th></span></q></dt></tr></i><div id='gkzMD'><tfoot id='gkzMD'></tfoot><dl id='gkzMD'><fieldset id='gkzMD'></fieldset></dl></div>

                  <legend id='gkzMD'><style id='gkzMD'><dir id='gkzMD'><q id='gkzMD'></q></dir></style></legend>

                  <tfoot id='gkzMD'></tfoot>
                    <bdo id='gkzMD'></bdo><ul id='gkzMD'></ul>

                  <small id='gkzMD'></small><noframes id='gkzMD'>