简体   繁体   English

如何在同一个 apache 服务器上为两个项目运行两个版本的 PHP

[英]How to run two versions of PHP for two projects on same apache server

I have 2 different virtual hosts on my apache server.我的 apache 服务器上有 2 个不同的虚拟主机。 One of them needs php7.x and another need php5.x.其中一个需要php7.x,另一个需要php5.x。

Is it possible to use project-specific PHP versions?是否可以使用项目特定的 PHP 版本?

I have tried the following,我尝试了以下方法,

Running two PHP versions on the same server 在同一台服务器上运行两个 PHP 版本

but my apache server crashed saying there's some syntactical error in one of the fpm's config file.但是我的 apache 服务器崩溃了,说 fpm 的配置文件之一中存在一些语法错误。

Also I cant follow this solution since It advices to uninstall apache and start over again and I can't do that on a live server.此外,我无法遵循此解决方案,因为它建议卸载 apache 并重新开始,而我无法在实时服务器上执行此操作。

Is there any way to do this without uninstalling the apache server.有没有办法在不卸载apache服务器的情况下做到这一点。 Thank you for your suggestions.谢谢你的建议。

for windows on file httpd-vhosta.conf对于文件 httpd-vhosta.conf 上的 Windows

<VirtualHost *:80>
    DocumentRoot "d:/server/htdocs/"
    ServerName localhost
    ServerAlias www.localhost

    <Directory "d:/server/htdocs/">
        Require all granted
        <Files ~ "\.php$">
            AddHandler fcgid-script .php
            #FcgidWrapper "d:/server/php/php-5.6.40-Win32-VC11-x64/php-cgi.exe" .php
            FcgidWrapper "d:/server/php/php-7.1.24-Win32-VC14-x64/php-cgi.exe" .php
            Options +ExecCGI
        </Files>
    </Directory>
    ErrorLog "D:/server/apache/logs/error-localhost.log"
    SetEnv APP_ON_LOCAL 1

</VirtualHost>

如何在 Debian Etch 上使用 mod_fcgid 和 PHP5 设置 Apache2 https://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-debian-etch

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM