ppa安装php版本

如果你想安装PHP的特定版本,那么这篇文章可以帮助你。这篇文章将帮助您安装PHP 5.4和PHP 5.5 PHP 5.6,通过使用PPA在Ubuntu 15.10 LTS,14.04或12.04 LTS系统。如果你的系统已经安装了更高版本,你需要安装较低的版本,那么你就得先删除更高版本,然后从系统中删除易储存库。

安装PHP 5.4 

使用如下命令添加PPA到Ubuntu系统中。

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php5-oldstable
$ sudo apt-get update
$ sudo apt-get install -y php5

检查已安装PHP版本:

# php -v

PHP 5.4.35-1+deb.sury.org~precise+1 (cli) (built: Nov 19 2014 19:34:07)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

安装PHP 5.5

使用如下命令添加PPA到Ubuntu系统中。

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php5
$ sudo apt-get update
$ sudo apt-get install -y php5

检查已安装PHP版本:

复制代码
# php -v

PHP 5.5.19-1+deb.sury.org~precise+1 (cli) (built: Nov 19 2014 19:32:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
复制代码

安装PHP 5.6

使用如下命令添加PPA到Ubuntu系统中。

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php5-5.6
$ sudo apt-get update
$ sudo apt-get install -y php5

检查已安装PHP版本:

复制代码
# php -v

PHP 5.6.3-1+deb.sury.org~precise+1 (cli) (built: Nov 19 2014 19:34:53)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

 

复制代码

 

安装PHP 7.0

使用如下命令添加PPA到Ubuntu系统中。

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php7.0

检查已安装PHP版本:

$ php -v 

PHP 7.0.1-4+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

 

注意:php7.0不支持12.04版本

安装PHP 7模块

您可能还需要根据您的应用程序要求安装模块。使用下面的命令来找到我们现有的PHP 7模块。

复制代码
$ sudo apt-cache search php7-* 


php7.0-common - Common files for packages built from the PHP source
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.0-dev - Files for PHP7.0 module development
php7.0-dbg - Debug symbols for PHP7.0
php7.0-curl - CURL module for PHP
php7.0-gd - GD module for PHP
php7.0-imap - IMAP module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-tidy - tidy module for PHP
php7.0-json - JSON module for PHP
php-all-dev - package depending on all supported PHP development packages
php7.0-sybase - Sybase module for PHP
php7.0-modules-source - PHP 7.0 modules source package
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-opcache - Zend OpCache module for PHP
复制代码

现在安装所需的模块:

$ sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi

 

 

转载自:http://tecadmin.net/install-php5-on-ubuntu/;

posted @ 2016-10-16 13:42  brady-wang  阅读(1654)  评论(0编辑  收藏  举报