简体   繁体   中英

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

I have 2 different virtual hosts on my apache server. One of them needs php7.x and another need php5.x.

Is it possible to use project-specific PHP versions?

I have tried the following,

Running two PHP versions on the same server

but my apache server crashed saying there's some syntactical error in one of the fpm's config file.

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.

Is there any way to do this without uninstalling the apache server. Thank you for your suggestions.

for windows on file httpd-vhosta.conf

<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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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