設計作品:在Virtualmin與webmin中安裝多個PHP版本讓虛擬主機使用

作者:webmaster 於 2013年02月26日 10:45:06
13794
次閱讀
如果您的網站伺服器有安裝多個PHP版本,Virtualmin支援您針對不同網域或是不同目錄指定不同的PHP版本。
If you have multiple PHP versions installed, Virtualmin allows you to choose which version to use for a given domain, or even per-directory.

Installing PHP 5.5 on CentOS 7 在CentOS 7上安裝PHP 5.5

  • Install the SCL Utils:

yum install scl-utils

  • Install repository package

rpm -Uvh https://www.softwarecollections.org/re ... l-7-x86_64-1-2.noarch.rpm

  • Install the PHP packages

yum install php55 php55-php-mysqlnd

Lastly, see the information on configuring the second PHP version below.

Installing PHP 5.6 on CentOS 7 在CentOS 7上安裝PHP 5.6

  • Install the SCL Utils:

yum install scl-utils

  • Install repository package

rpm -Uvh https://www.softwarecollections.org/re ... -epel-7-x86_64.noarch.rpm

  • Install the PHP packages

yum install rh-php56 rh-php56-php-mysqlnd

Lastly, see the information on configuring the second PHP version below.

Configuring the second PHP Version in Virtualmin

Once you have completed the installation of a second PHP version on your server, you can verify that Virtualmin sees it by logging into Virtualmin, and clicking System Settings -> Re-Check Config. You should see something like this:

The following PHP versions are available : 5.3.3 (/usr/bin/php-cgi), 5.6.x (/opt/rh/php56/root/usr/bin/php-cgi)

You can configure which one is the default PHP version used on new Virtual Servers. The default is to use the newest available. You can change that default in System Settings -> Server Templates -> Default -> Apache Website, and on that screen you can set the default PHP version to use in the field Default PHP version.

Configuring Individual Virtual Servers

You can configure the PHP version being used for a specific Virtual Server by selecting Server Configuration -> PHP Versions.

The first line there specifies what PHP version will be used by default.

If you wish, you can specify a different PHP version to be used for a specific directory.