Centos设置默认的PHP版本

执行命令查看当前php版本,会得到下面提示,那么我们的目的是将当前php版本更换为php更好版本,以符合开发环境要求。

1、查看当前php版本

[root@izm5e4u1jmuzijy7bp2ct1z ~]# php -v
PHP 5.6.30 (cli) (built: Nov  9 2018 16:03:13) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

2、获取php安装目录

使用命令获取当前可切换的php版本目录有哪些

[root@izm5e4u1jmuzijy7bp2ct1z ~]# find / -name php
/usr/bin/php
/usr/local/php
/usr/local/php/php
/usr/local/php/php/php
/usr/local/php/bin/php
/usr/local/php/include/php
/usr/local/php/lib/php
/usr/local/php5.5/php
/usr/local/php5.5/php/php
/usr/local/php5.5/bin/php
/usr/local/php5.5/include/php
/usr/local/php5.5/lib/php
/usr/local/php7.0/php
/usr/local/php7.0/php/php
/usr/local/php7.0/bin/php
/usr/local/php7.0/include/php
/usr/local/php7.0/lib/php
/usr/local/php7.1/php
/usr/local/php7.1/php/php
/usr/local/php7.1/bin/php
/usr/local/php7.1/include/php
/usr/local/php7.1/lib/php

3、根据目录替换当前最高php版本

那么目前最高安装php版本为7.1,接下来执行命令将当前php版本替换成7.1

[root@izm5e4u1jmuzijy7bp2ct1z ~]# ln -s /usr/local/php7.1/bin/php

无报错标识成功

4、替换php版本

[root@izm5e4u1jmuzijy7bp2ct1z ~]# export PATH=/usr/local/php7.1/bin:$PATH
接下来查看当前php版本是否切换成功

[root@izm5e4u1jmuzijy7bp2ct1z ~]# php -v
PHP 7.1.3 (cli) (built: Nov  9 2018 16:37:45) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.3, Copyright (c) 1999-2017, by Zend Technologies

这样就将php版本切换成功了

阅读 449

Comments

p

ps4 games 13小时前

Actually no matter if someone doesn't know after that its up to other visitors that they will help, so here it takes place.

回复此评论

p

ps4 games 1天前

My brother suggested I might like this website. He was totally right. This post actually made my day. You cann't imagine simply how much time I had spent for this info! Thanks!

回复此评论

p

ps4 games 3天前

It's going to be end of mine day, but before finish I am reading this impressive piece of writing to improve my know-how.

回复此评论

p

ps4 games 3天前

Its like you learn my thoughts! You appear to know a lot approximately this, like you wrote the guide in it or something. I believe that you simply can do with a few p.c. to drive the message home a little bit, however other than that, that is magnificent blog. An excellent read. I'll definitely be back.

回复此评论

q

quest bars cheap 5天前

Outstanding quest there. What occurred after? Take care!

回复此评论

q

quest bars cheap 6天前

Truly when someone doesn't understand afterward its up to other viewers that they will assist, so here it happens.

回复此评论

p

ps4 games 1周前

Thanks for another informative web site. The place else may just I get that kind of information written in such a perfect way? I've a undertaking that I am just now operating on, and I have been at the glance out for such info.

回复此评论

p

ps4 games 1周前

Excellent goods from you, man. I have take into account your stuff previous to and you are simply too fantastic. I actually like what you have acquired here, really like what you are saying and the best way in which you are saying it. You are making it entertaining and you still take care of to stay it wise. I can't wait to learn far more from you. This is really a tremendous site.

回复此评论

p

ps4 games 1周前

Hello there! I know this is somewhat off topic but I was wondering which blog platform are you using for this site? I'm getting fed up of Wordpress because I've had problems with hackers and I'm looking at alternatives for another platform. I would be awesome if you could point me in the direction of a good platform.

回复此评论

p

ps4 games 1周前

My programmer is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the costs. But he's tryiong none the less. I've been using WordPress on various websites for about a year and am worried about switching to another platform. I have heard excellent things about blogengine.net. Is there a way I can transfer all my wordpress content into it? Any help would be greatly appreciated!

回复此评论

q

quest bars cheap 1周前

Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! However, how can we communicate?

回复此评论

q

quest bars cheap coupon twitter 1周前

Wow! Finally I got a website from where I be able to in fact obtain helpful information regarding my study and knowledge.

回复此评论

q

quest bars cheap 1周前

Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is fantastic, let alone the content!

回复此评论

q

quest bars cheap 1周前

I know this if off topic but I'm looking into starting my own weblog and was curious what all is required to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very internet smart so I'm not 100% sure. Any tips or advice would be greatly appreciated. Many thanks

回复此评论

q

quest bars cheap 1周前

What a stuff of un-ambiguity and preserveness of precious experience concerning unpredicted emotions.

回复此评论

p

ps4 games 2周前

What's up to every one, for the reason that I am actually keen of reading this web site's post to be updated on a regular basis. It carries pleasant material.

回复此评论

p

ps4 games 2周前

Good answer back in return of this question with genuine arguments and describing the whole thing regarding that.

回复此评论

c

coconut oil or 2周前

I like the valuable info you provide to your articles. I will bookmark your weblog and check once more right here regularly. I am reasonably sure I will be told lots of new stuff right here! Good luck for the next!

回复此评论

h

http://tinyurl.com/ 2周前

This blog was... how do you say it? Relevant!! Finally I've found something which helped me. Thanks a lot!

回复此评论

t

tinyurl.com 2周前

I am really inspired with your writing skills and also with the structure for your weblog. Is that this a paid subject or did you modify it yourself? Anyway keep up the nice quality writing, it is uncommon to look a nice blog like this one today..

回复此评论