Skip to content

Instantly share code, notes, and snippets.

@kslimani
Last active August 13, 2019 13:38
Show Gist options
  • Save kslimani/7f79149ab4eac2b273c3c3bd7c24ecdb to your computer and use it in GitHub Desktop.
Save kslimani/7f79149ab4eac2b273c3c3bd7c24ecdb to your computer and use it in GitHub Desktop.

Upgrade PHP to 7.2 on Debian 8

LibreNMS minimim requirements will change to php >= 7.1.

Uninstall PHP 5 :

apt-get remove php-net-ipv4 php-net-ipv6 php-pear php5-cli php5-common php5-curl php5-fpm php5-gd php5-json php5-mcrypt php5-mysqlnd php5-snmp

Install Sury APT :

apt install lsb-release apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury.org.list
apt update

Install PHP 7.2 :

apt-get install php7.2-cli php7.2-curl php7.2-fpm php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-snmp php7.2-xml php7.2-zip

Then create custom configuration file /etc/php/7.2/mods-available/custom-settings.ini :

; priority=99
[Date]
date.timezone = "Europe/Paris"

Enable custom configuration :

ln -s /etc/php/7.2/mods-available/custom-settings.ini /etc/php/7.2/cli/conf.d/99-custom-settings.ini
ln -s /etc/php/7.2/mods-available/custom-settings.ini /etc/php/7.2/fpm/conf.d/99-custom-settings.ini

In Nginx configuration file, replace fastcgi_pass unix:/var/run/php5-fpm.sock; by fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;.

Finally, restart fpm and nginx services.

Upgrade PHP to 7.3

Stop services :

service nginx stop
service php7.1-fpm stop

Install PHP 7.3 :

apt-get install php7.3-cli php7.3-dev php7.3-pgsql php7.3-sqlite3 php7.3-gd php7.3-curl php7.3-imap php7.3-mysql php7.3-mbstring php7.3-xml php7.3-zip php7.3-bcmath php7.3-soap php7.3-intl php7.3-readline php7.3-fpm php-memcached

Remove previous packages :

apt-get purge php7.1*

In Nginx configuration file, replace fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; by fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;.

Finally, restart fpm and nginx services.

service php7.3-fpm restart
service nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment