如何在XAMPP中运行多个PHP版本?

3

我有多个基于PHP的项目。有些需要PHP 5.x版本运行,而其他则严格要求使用 PHP 7.0或更高版本。我正在同时进行这些项目的开发。是否有一种方法可以运行多个PHP版本,这样我就可以在处理不同项目时进行版本切换。

2个回答

6

0
>> Open C:\xampp\apache\conf\extra\httpd-xampp.conf
>> Write Following code at Bottom of this (httpd-xampp.conf) file

    ScriptAlias /php56 "C:/xampp/php56"
    <Directory "C:/xampp/php56">
        AllowOverride None
        Options None
        Require all denied
        <Files "php-cgi.exe">
            Require all granted
        </Files>
    </Directory>

>> Open C:\xampp\apache\conf\extra\httpd-vhosts.conf\httpd-vhosts.conf
>> Create a virchual host in Different post By Writing Following code

    <VirtualHost *:8081>
        UnsetEnv PHPRC
        <FilesMatch "\.php$">
            php_flag engine off
            SetHandler application/x-httpd-php5_6
            Action application/x-httpd-php5_6 "/php5_6/php-cgi.exe"
        </FilesMatch>
        DocumentRoot "C:/xampp/htdocs/myphp5_6_project"
    </VirtualHost>

>> Create a folder "myphp5_6_project" in htdocs of xampp
>> Open C:\xampp\apache\conf\httpd.conf
>> Write Listen 8081 (any where or Below Listen 80 line)
>> Restart Apache Services

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接