2012年10月10日 星期三

CentOS6.2安裝php5.2.17

CentOS6.2的PHP版本是5.3,一些舊程式無法正常執行。
以下為將PHP改安裝5.2.17版的方式
  1. 移除原先的php5.3及相關套件。(我一開始沒安裝php,所以就略過這步)
  2. 到以下網址下載php5.2.17的相關套件
    32位元:http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/
    64位元:http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/
    我作業系統是32位元的,所以下載以下32位元的檔案
    (可依自己需要,選擇自己需要的下載即可)
    可將下列連結儲存成文字檔,例如 test.txt,再用 wget -i test.txt 指令批次下載回來
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-bcmath-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-cli-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-common-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-dba-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-devel-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-embedded-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-gd-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-imap-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-ldap-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-mbstring-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-mcrypt-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-mhash-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-mssql-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-mysql-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-ncurses-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-odbc-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-pdo-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-pgsql-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-process-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-pspell-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-recode-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-snmp-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-soap-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-tidy-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-xml-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-xmlrpc-5.2.17-1.el6.art.i686.rpm
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-zts-5.2.17-1.el6.art.i686.rpm
    
  3. 安裝下載回來的php5.2.17
    rpm --oldpackage -Uvh php*
  4. 我安裝時出現了相依性的問題
    錯誤:相依性偵測失敗:
            autoconf 被 php-devel-5.2.17-1.el6.art.i686 所需要
            automake 被 php-devel-5.2.17-1.el6.art.i686 所需要
            libXpm.so.4 被 php-gd-5.2.17-1.el6.art.i686 所需要
            libt1.so.5 被 php-gd-5.2.17-1.el6.art.i686 所需要
            libc-client.so.2007 被 php-imap-5.2.17-1.el6.art.i686 所需要
            libmcrypt.so.4 被 php-mcrypt-5.2.17-1.el6.art.i686 所需要
            libmhash.so.2 被 php-mhash-5.2.17-1.el6.art.i686 所需要
            libsybdb.so.5 被 php-mssql-5.2.17-1.el6.art.i686 所需要
            libodbc.so.2 被 php-odbc-5.2.17-1.el6.art.i686 所需要
            libpq.so.5 被 php-pgsql-5.2.17-1.el6.art.i686 所需要
            libaspell.so.15 被 php-pspell-5.2.17-1.el6.art.i686 所需要
            libpspell.so.15 被 php-pspell-5.2.17-1.el6.art.i686 所需要
            librecode.so.0 被 php-recode-5.2.17-1.el6.art.i686 所需要
            libtidy-0.99.so.0 被 php-tidy-5.2.17-1.el6.art.i686 所需要
    
  5. 嘗試安裝其他相依的套件,但有些原來的CentOS6.2沒有,
    所以又下載了 atomic-release-1.0-14.el6.art.noarch.rpm 安裝。
    rpm -Uvh atomic-release*rpm
    32位元:
    http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/atomic-release-1.0-14.el6.art.noarch.rpm
    64位元:
    http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/atomic-release-1.0-14.el6.art.noarch.rpm
  6. 再安裝一次其他相依的套件
    yum install autoconf automake libXpm.so.4 libt1.so.5 libc-client.so.2007 libmcrypt.so.4 libmhash.so.2 libsybdb.so.5 libodbc.so.2 libpq.so.5 libaspell.so.15  libpspell.so.15 librecode.so.0 libtidy-0.99.so.0
  7. 安裝php5.2.17
    rpm --oldpackage -Uvh php*
  8. 安裝完可用以下指令查看PHP版本
    php -v
  9. 將yum的更新排除PHP
    編輯/etc/yum.conf

    vi /etc/yum.conf
    在最後新增一行
    exclude=php*
    儲存後可用
    yum check-update | grep php  檢查是否還有PHP更新的資料

沒有留言:

張貼留言