問題:如服務器產品中,綁定的系統是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
php
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 # 配置 mysql
8. make && make install # 編譯並安裝(在/opt/php53)
sql
9. vi /etc/apache2/conf.d/includes/pre_main_global.conf # 向apache的配置文件添加如下內容,令其默認使用php5.3 apache