4 years ago

How to upgrade from PHP 5 to PHP 7.0 on Ubuntu 14.04 with nginx 1.4.6

Posted 4 years ago by carloshc

Some few steps I have done to upgrade to PHP 7.0

$ sudo service nginx stop
$ sudo apt-get purge php5-*
$ sudo add-apt-repository ppa:ondrej/php-7.0
$ sudo apt-get update
$ sudo apt-get install php7.0 php7.0-common php7.0-cgi php7.0-fpm php7.0-mysql

Edit your site config:

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

An example:

server {

    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/;
    index index.php index.html index.htm;

    server_name laravel;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    location ~ \.php$ {
        include                  fastcgi_params;
        fastcgi_keep_conn on;
        fastcgi_index            index.php;
        fastcgi_split_path_info  ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

Start your nginx:

$ sudo service nginx start


Please sign in or create an account to participate in this conversation.