dsf5632 2016-01-27 15:42
浏览 79
已采纳

在Cent OS中升级PHP

For some reason, I have to upgrade PHP version from 5.3.3 to 5.3.10 in order to let Joomla to run. But I googled for hours. All sources pointed to adding new repositories and typing some commands to upgrade. But in the end I can't upgrade the php from these repositories, not even to this specific version 5.3.10.

My production environment is running on 5.3.10. So it is better for me to upgrade to 5.3.10 as well. Is it because the version is too old that it cannot be installed from now?

I tried to download PHP from php.net and installed one. But I guess the httpd cannot recognize such PHP installations so that even I installed a newer version of PHP, my website still crash.

I would really appreciate any advice. Thanks.

  • 写回答

1条回答 默认 最新

  • dounianxie2058 2016-01-28 05:19
    关注

    I had a similar problem before.

    1. Remove php* installed by yum before

      yum remove php php-common php-cli
      
    2. Download PHP 5.3.10. Unzip & switch into its directory

    3. Install library required (Referring : http://open.litespeedtech.com/mediawiki/index.php/Help:Building_PHP_for_Joomla)

      yum install mysql mysql-devel mysql-server libxml2-devel gd-devel gcc gcc-c++ make patch
      yum install httpd-devel libpng-devel #for apxs2; added for missing png headers
      
    4. Configure the build files with extension which Joomla would use

      ./configure --prefix=/opt/php5.3.10 --with-apxs2=/usr/sbin/apxs --with-mysql --with-mysqli --with-zlib --with-gd --enable-shmop --enable-sockets --enable-sysvsem --enable-sysvshm --enable-mbstring --with-iconv --with-libdir=lib64 --with-config-file-path=/etc/php.ini --with-config-file-scan-dir=/etc/php.d
      
      make install
      

      I use --with-libdir=lib64 because I find libmysqlclient.so in /usr/lib64

      and --prefix, --with-config-file-path, --with-config-file-scan-dir are optional

    5. According to the warning during make install (please find your version at the end of it)

      libtool --finish /home/myuser/php-5.3.10/libs
      
    6. Copy the config file to where it should be

      cp php.ini-production /etc/php.ini
      
    7. Add the index.php in httpd.conf Directory Index

      DirectoryIndex index.php index.html index.html.var
      
    8. Restart httpd and it should be able to process php files

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大