linux里怎么升级php版本

linux里怎么升级php版本,第1张

1:进入终端后查看PHP版本

php -v

输出可能如下:

PHP 5.4.35 (cli) (built: Nov 14 2014 07:04:10) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologieswith Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

2:执行下面的命令升级软件仓库

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

3:执行下面的命令删除php

yum remove php-common

然后像安装那样问你是否继续的,输入yes即可

4:安装php 5.6版本(php56w-devel这个不是必需的)

yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-MySQL php56w-intl php56w-mbstring

5:重启httpd

service httpd restart

查看最新的版本

php -v

现在应该是5.6了!

升级的命令是 rpe -U +你要升级的软件包名! 应用在 LINUX 4.0 服务器版上面你的 如果软件包格式不是 RPM 格式的 LINUX 是不支持 安装和 升级的 你必须进行编译之后才可以进行安装和升级,升级的时候最好进入那软件包名的 目录下 进行升级 比如说 你的php是在 home/123/php 这里123 是我新建存放phph软件的 目录 下面是具体命令: cd /home/123cd/123rpm -U php 即可完成

下面是Centos下wdcp将php5.2升级到5.3的命令,亲可以参考一下。

cd /tmp

wget -c http://dl.wdlinux.cn:5180/soft/php-5.3.10.tar.gz

tar zxvf php-5.3.10.tar.gz

cd php-5.3.10

./configure --prefix=/www/wdlinux/php-5.3.10 --with-config-file-path=/www/wdlinux/etc --with-mysql=/www/wdlinux/mysql --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-ftp --with-apxs2=/www/wdlinux/apache/bin/apxs

make

make install

rm -f /www/wdlinx/php

ln -s /www/wdlinux/php-5.3.10 /www/wdlinux/php

service httpd restart

使用过程中记得修改上面命令中的路径哦。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/8076631.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-13
下一篇2023-04-13

发表评论

登录后才能评论

评论列表(0条)

    保存