Site icon Daniel Sobrinho

PHP7.4 no Debian

Como instalar o php7.4 e php7.4-fpm no Debian, Deepin, Ubuntu, Mint, etc.

Instale o repositório:
~$ apt install gnupg2 -y
~$ wget -qO – https://packages.sury.org/php/apt.gpg | sudo apt-key add –
~$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.x.list

Atualize:
~$ apt update
~$ apt upgrade

Instale:
~$ apt install php7.4

Instale com extensões mais comumente usadas:
~$ sudo apt install php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline libphp7.4-embed php7.4-bz2 php7.4-common php7.4-curl php7.4-dba php7.4-fpm php7.4-gd php7.4-interbase php7.4-intl php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-pgsql php7.4-phpdbg php7.4-soap php7.4-sqlite3 php7.4-tidy php7.4-xml php7.4-xsl php7.4-zip

Trocando versão do php:
~$ update-alternatives –set php /usr/bin/php7.4
~$ update-alternatives –set phar /usr/bin/phar7.4
~$ update-alternatives –set phar.phar /usr/bin/phar.phar7.4

Ativando o php7.4-fpm:
~$ systemctl disable php*-fpm (troque * pela versão da atualmente ativa)
~$ systemctl stop php*-fpm
~$ systemctl enable php7.4-fpm
~$ systemctl start php7.4-fpm
~$ systemctl restart apache2