Install
Ubuntu
Test OS: Ubuntu 15.10
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.0 -y --force-yes
Debian
Test OS: Debian 8 x64 (jessie)
Edit /etc/apt/sources.list, replacing
<distribution>
with either sequeeze
,
wheezy
, jessie
.
deb http://packages.dotdeb.org <distribution> all
deb-src http://packages.dotdeb.org <distribution> all
Add the GPG key:
#download gpg
wget https://www.dotdeb.org/dotdeb.gpg
#when you added it, you can delete it as you like
sudo apt-key add dotdeb.gpg
Install:
sudo apt-get update
sudo apt-get install php7.0
PS: If you meet some problems when you excute
apt-get update
, you may need to check
/etc/apt/sources.list
.
Check
root@Ubuntu:~# php -v
PHP 7.0.6-13+donate.sury.org~wily+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
Modules
root@Ubuntu:~# apt-cache search php7-*
php-radius - radius client library for PHP
php-http - PECL HTTP module for PHP Extended HTTP Support
php-uploadprogress - file upload progress tracking extension for PHP
php-mongodb - MongoDB driver for PHP
php7.0-common - documentation, examples and common module for PHP
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-curl - CURL module for PHP
php7.0-enchant - Enchant module for PHP
php7.0-gd - GD module for PHP
...
Install specific modules with command below:
apt-get install php7.0-mysql php7.0-curl
PHP-FPM & Nginx
apt-get install nginx
apt-get install php7.0-fpm
Edit /etc/nginx/sites-enabled/default
, check the
configuration below for advisory optinoin purpose.
server {
...
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Reference
- http://tecadmin.net/install-php-7-on-ubuntu/
- https://www.colinodell.com/blog/2015-12/installing-php-7-0-0
- https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04