如何使用XAMPP运行多个PHP版本?

时间:2019-03-12 05:40:44

标签: apache xampp

我有多个基于PHP的项目。有些要求运行PHP 5.x版本,而其他一些要求PHP 7.0或更高版本。我正在同时处理这些。有没有一种方法可以运行多个PHP版本,以便在处理不同项目时可以在它们之间进行切换。

1 个答案:

答案 0 :(得分: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