开发者社区> 问答> 正文

在新版本WHM (64.0)中安装php5.3

问题:如服务器产品中,绑定的系统是CentOS 6 + cPanel,支持php5.5以上的版本,但网站程序必须是php5.3

过程:

1. 在 whm 里查看多版本的php中,并没有php5.3


2. yum groupinstall 'Development Tools' # 安装开发组件

3. yum install epel-release # 增加软件安装源

4. yum install sqlite-devel libxml2-devel bzip2-devel libcurl-devel libc-client-devel libmcrypt-devel aspell-devel libedit-devel libtidy-devel pcre-devel # 安装相关的开发包

5. wget http://cn2.php.net/distributions/php-5.3.29.tar.gz # 下载php5.3源码包

6. 解压到 /usr/src/php-5.3.29

7. ./configure  --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-mbstring --enable-pdo=shared --enable-sockets --enable-zip --prefix=/opt/php53  --with-bz2 --with-curl=/usr --with-freetype-dir=/usr --with-gd --with-imap=/usr --with-imap-ssl --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/usr --with-mcrypt=/usr --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/usr --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-sqlite=shared --with-tidy=/usr --with-xmlrpc --with-xpm-dir=/usr --with-zlib --with-zlib-dir=/usr # 配置


8. make && make install # 编译并安装(在/opt/php53)


9. vi /etc/apache2/conf.d/includes/pre_main_global.conf # 向apache的配置文件添加以下内容,令其默认使用php5.3
AddHandler application/x-httpd-php53 php

ScriptAlias /local-bin /opt/php53/bin
Action application/x-httpd-php53 /local-bin/php-cgi

<Directory "/opt/php53/bin">
    Order allow,deny
    Allow from all
</Directory>


10. /etc/init.d/httpd reload # 重新加载apache配置参数

11. 查看phpinfo输出信息,是php5.3版本了



参考:

  • https://www.brucedev.com/posts/php-53-in-easyapache-4
  • http://blog.51cto.com/343416/1983674

展开
收起
dongshan8 2018-04-30 18:02:32 5072 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
PHP 2017.北京 全球开发者大会——高可用的PHP 立即下载
PHP安全开发:从白帽角度做安全 立即下载
复杂PHP系统性能瓶颈排查及优化 立即下载