你的位置:国外/美国服务器租用 技术文档 Virtualmin使用教程 正文
如何给webmin/virtualmin安装不同版本的PHP,安装php5.4
  • 如何给webmin/virtualmin安装不同版本的PHP,安装php5.4

    Introduction

    Beginning in Virtualmin 3.99, if you have multiple PHP versions installed, you can choose which version to use for a given domain, or even per-directory.

    While this feature can work with any Operating System version, it works best with CentOS 5 and 6 using the Software Collections repository.

    Installing a second PHP Version on CentOS 5 or 6

    CentOS supports something called "Software Collections", which is a system for installing multiple software versions on one server. Using packages provided by a third party in the Software Collections repository, it's possible to install PHP 5.4 in /opt/, while keeping your current PHP version installed in /usr/.

    To install PHP 5.4 from the Software Collections repository, you perform the following steps:

    1. Log into your server over SSH as root
    2. Download the .repo file by running the command wget -O /etc/yum.repos.d/software_collections_php54.repo http://people.redhat.com/rcollet/php54/rhel-php54.repo
    3. Install PHP 5.4 and scl-utils with this command: yum install php54 php54-php-cli php54-php-mysql php54-php-gd

    Configuring the second PHP Version in Virtualmin

    Once you have completed the installation of a second PHP version, 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.4.11 (/opt/rh/php54/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.

    安装常用php组件

    yum --enablerepo=php54 install php54-php-curl php54-php-xml php54-php-dom php54-php-mcrypt php54-php-gd php54-php-mbstring php54-php-mhash php54-php-pdo php54-php-soap php54-php-snmp php54-php-odbc php54-php-imap

    如果发现mysql不能连接,参考下面:

    [warn] mod_fcgid: stderr: PHP Warning:  mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('www.ctohome.com'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

  • 点这里复制本页地址发送给您QQ/MSN上的好友
  • 相关文章
  • 本文章所属分类:首页 技术文档 Virtualmin使用教程