PHP7 has released on Dec,2015 and explains much faster than php 5.x but in noise it is not very stabled yet.

Anyway, I have installed php7 and very satisfied.

0. Installation

php7 apt packages are not released yet in Raspbian public repository. So There are 2 options.

I will go with option (b).

1) Add mati75’s repository on your repo list

Open repository list by

$ sudo nano /etc/apt/sources.list

Copy and paste below:

deb jessie-backports main contrib non-free
#deb-src jessie-backports main contrib non-free

2) Add mati75’s repository public key

$ gpg --keyserver --recv-key CCD91D6111A06851
$ gpg --armor --export CCD91D6111A06851 | sudo apt-key add -

If you success to public key, update package list.

$ sudo apt update -y

3) Install php7.0 and some modules to use with Nginx, Maria DB and Wordpress

$ sudo apt install php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-readline -y

1. Check php settings for nginx

As I am using php7.0-fpm to speed up nginx, find out php-7.0 fpm unix socket setting in /etc/php/7.0/fpm/pool.d/www.conf

$ sudo nano /etc/php/7.0/fpm/pool.d/www.conf

You can find listen = /run/php/php7.0-fpm.sock.

You have to put this socket in nginx site setting.

Open default setting file,

$ sudo nano /etc/nginx/sites-available/default

and put fastcgi_pass unix:/run/php/php7.0-fpm.sock; in your server block.

Don’t forget to uncomment location ~ \.php$.

Also add index.php; for nginx index.

2. Checking

Create index.php file to check php and nginx configuration is correct.

$ sudo rm -R /var/www/html/* && sudo nano /var/www/html/index.php

Paste <?php phpinfo(); ?> then save and close.

Restart php7-fpm and nginx.

$ sudo service php7.0-fpm stop && sudo service nginx stop
$ sudo service php7.0-fpm start && sudo service nginx start

Run service, check your site is working by web browser by access with Raspberry Pi ip address.

If you see folowing screen, you have successed.