【问题标题】:Upgrade PHP in Cent OS在 Centos 中升级 PHP
【发布时间】:2016-01-27 15:42:02
【问题描述】:

出于某种原因,我必须将 PHP 版本从 5.3.3 升级到 5.3.10 才能让 Joomla 运行。但我用谷歌搜索了几个小时。所有消息来源都指向添加新存储库并键入一些命令进行升级。但最后我无法从这些存储库中升级 php,甚至无法升级到这个特定的 5.3.10 版本。

我的生产环境在 5.3.10 上运行。所以我也升级到 5.3.10 会更好。是不是因为版本太旧,现在不能安装了?

我尝试从 php.net 下载 PHP 并安装了一个。但是我猜 httpd 无法识别这样的 PHP 安装,所以即使我安装了更新版本的 PHP,我的网站仍然崩溃。

我非常感谢任何建议。谢谢。

【问题讨论】:

  • 您尝试从哪个 repo 获取 php?
  • 如果您使用 WHM,那么您只需点击几下即可使用 EasyApache 执行此操作 - 您不必担心手动操作。

标签: php joomla centos


【解决方案1】:

我之前也遇到过类似的问题。

  1. 删除之前yum安装的php*

    yum remove php php-common php-cli
    
  2. 下载 PHP 5.3.10。解压并切换到它的目录

  3. 需要安装库 (参考: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. 使用 Joomla 将使用的扩展名配置构建文件

    ./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
    

    我使用--with-libdir=lib64,因为我在 /usr/lib64 中找到了 libmysqlclient.so

    --prefix, --with-config-file-path, --with-config-file-scan-dir 是可选的

  5. 根据make install期间的警告(请在末尾找到您的版本)

    libtool --finish /home/myuser/php-5.3.10/libs
    
  6. 将配置文件复制到应有的位置

    cp php.ini-production /etc/php.ini
    
  7. 在httpd.conf目录索引中添加index.php

    DirectoryIndex index.php index.html index.html.var
    
  8. 重启httpd应该可以处理php文件了

【讨论】:

    猜你喜欢
    • 2016-05-18
    • 2014-02-25
    • 1970-01-01
    • 2019-03-20
    • 2017-09-03
    • 2015-07-22
    • 2021-08-13
    • 1970-01-01
    • 2012-02-03
    相关资源
    最近更新 更多