Install PHP7.2  and PHP7.2-FPM on Ubuntu 16.04

Install PHP7.2 and PHP7.2-FPM on Ubuntu 16.04

Linux 1 week ago 32 0

The third blog is finally half done! Since you changed Laravel 6. *, you need to change the PHP version, so record it.

Uninstall

To change the PHP version, you must first delete the original version.

Remove related packages and configuration of PHP

   sudo apt-get autoremove php7*

Delete association

    sudo find /etc -name "*php*" |xargs  rm -rf 

Clear dept list

sudo apt purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

Check if the uninstall is clean

dpkg -l | grep php
无返回就是卸载完成

Install

add repository

sudo add-apt-repository ppa:ondrej/php

update

sudo apt update

Install php7.2 and some important modules weneed

sudo apt-get install php7.2-cli php7.2-fpm php7.2-curl php7.2-gd php7.2-mysql php7.2-mbstring php7.2-xml zip unzip

After installation, enter php -v.

start

    service php7.2-fpm start

Tip Upgraded PHP version, don't forget to modify Nginx. E.g:

location ~ \.php$ {
#       # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
#       # With php-cgi (or other tcp sockets):
#       fastcgi_pass 127.0.0.1:9000;
}

Restart Nginx

    service nginx restart

原文: http://yiqiao.me/articles/22/ubuntu-1604-upgrade-php

版权声明: 自由转载-非商用-非衍生-保持署名 (创意共享3.0许可证)