NGINX config update for PHP7.2 from 7.0 upgrade

After upgrading to 18.04LTS, discovered the following in LEMP stack serving:

/etc/nginx/site needs to be updated in the even of PHP7.2 upgrade from 7.0

This is the case for Ubuntu 16.04 LTS -> 18.04LTS upgrades!

 

 

in /etc/nginx/site CHANGE:


1
2
3
4
5
6
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/<span style="color: #ff0000;">php7.0</span>-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

TO


1
2
3
4
5
6
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/<span style="color: #3366ff;">php7.2</span>-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

Restarting NGINX & PHP (if needed)


1
2
sudo systemctl restart nginx.service
sudo systemctl restart php7.2-fpm.service