Une nouvelle version de PHP est sortie. Voici comment mettre à jour.

Mettre à jour le système Debian

# apt update && apt upgrade

Installer PHP et ses modules (version php7.2)

# apt install php7.2 php7.2-common php7.2-cli php7.2-fpm php7.2-mbstring php7.2-gd php7.2-xml php7.2-zip php7.2-curl

Intégrer la nouvelle version de PHP à Apache

Supprimez l’intégration de l’ancienne version de php (php7.1) avec Apache :

# a2dismod php7.1

Intégrez la nouvelle version :

# a2enmod php7.2

Retirez du système l’ancienne version de php

# apt purge php7.1*

Si vous utilisez userdir afin de mettre vos page dans public_html, n’oubliez pas de configurer les fichiers /etc/apache2/mods-available/userdir.conf et /etc/apache2/mods-available/php7.2.conf de cette façon :

userdir.conf

<IfModule mod_userdir.c>
  UserDir public_html
  UserDir disabled root

<Directory /home/*/public_html>
  AllowOverride all
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

php7.2.conf

<FilesMatch ".+\.ph(ar|p|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".+\.phps$">
    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(ar|p|ps|tml)$">
    Require all denied
</FilesMatch>

# Running PHP scripts in user directories is disabled by default
# 
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<IfModule mod_userdir.c>
#    <Directory /home/*/public_html>
#       php_admin_flag engine Off
#   </Directory>
#</IfModule>