我有多个基于PHP的项目。有些需要PHP 5.x版本运行,而其他则严格要求使用 PHP 7.0或更高版本。我正在同时进行这些项目的开发。是否有一种方法可以运行多个PHP版本,这样我就可以在处理不同项目时进行版本切换。
如果您没有,下载 libphp7.so:
https://github.com/prashant-techindustan/php7module_library/blob/master/libphp7.so
编辑 /opt/lampp/etc/extra/httpd-xampp.conf(注释掉不需要的其中一个):
LoadModule php5_module modules/libphp5.so
LoadModule php7_module modules/libphp7.so
启动 LAMP。
>> 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