Home > Backend Development > PHP Tutorial > Ubuntu 12.04 LTS 中将 PHP 从 5.3 升级到 5.5 笔记

Ubuntu 12.04 LTS 中将 PHP 从 5.3 升级到 5.5 笔记

WBOY
Release: 2016-06-23 13:17:06
Original
919 people have browsed it

在Ubuntu 12.04 LTS 中,使用

sudo apt-get install php5-fpm
Copy after login

安装的PHP 版本是 5.3,如果想要使用 Laravel 或 Yii2 框架,要求 PHP 版本至少是 5.5+,所以要对 PHP 版本进行升级。

升级步骤

初始化操作:

sudo apt-get updatesudo apt-get install python-software-properties
Copy after login

更新PPA源:

sudo add-apt-repository ppa:ondrej/php5
Copy after login

如果只是想升级到5.4,则执行如下命令:

sudo add-apt-repository ppa:ondrej/php5-oldstable
Copy after login

接下来执行更新和升级:

sudo apt-get updatesudo apt-get dist-upgrade
Copy after login

执行命令 php -v会发现已经更新成功。

注1

如果之前nginx中配置监听9000端口来处理PHP,那么要改成监听UNIX的socket,否则无法正确打开PHP页面。即将

fastcgi_pass 127.0.0.1:9000;
Copy after login

改成

fastcgi_pass unix:/var/run/php5-fpm.sock;
Copy after login

注2

upgrade和 dist-upgrade的区别:

dist-upgrade会识别出当依赖关系改变的情形并作出处理,而upgrade对此情形不处理。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template