PHP 7.1 on Debian for NGINX

Upgrading to PHP 7.1 was easy, the only place I encouraged issues, was with figuring out where the socket was located, after figuring this out I felt write an article over this would be a good idea and a big time saver for people.

apt-get install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg
echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get install php7.1-fpm php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-sqlite3 php7.1-gd php7.1-xml php7.1-mcrypt

Edit the Nginx config and replace the older FPM socket with a new one.

fastcgi_pass unix:/run/php/php7.1-fpm.sock;

Confused replace the whole PHP block with this.

location ~ \.php$ { 
fastcgi_pass unix:/run/php/php7.1-fpm.sock; fastcgi_index index.php; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
include fastcgi_params; 

Leave a Reply

Your email address will not be published.