Outils pour utilisateurs

Outils du site


php_7.3

PHP 7.4 & 8.1

Installation de PHP 7.4 et 8.1 sous debian 10 avec pris en charge de fpm.

Packages

Ajouter le dépôt et installer les packages en connexion sudo

curl https://packages.sury.org/php/apt.gpg -o /etc/apt/trusted.gpg.d/php.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update

Pour PHP 7.4

apt-get install -y php7.4-fpm php7.4-cli php7.4-mysql php7.4-pgsql php7.4-curl php7.4-xml php7.4-zip php7.4-intl php7.4-mbstring 
apt-get install -y php7.4-json php7.4-bz2 php7.4-bcmath php7.4-gmp php7.4-ldap php7.4-apcu php7.4-imagick imagemagick 
apt-get install -y php7.4-common php7.4-igbinary php7.4-redis php7.4-smbclient php7.4-opcache 
apt-get install -y php7.4-gd php7.4-apcu php7.4-imagick

Pour PHP 8.1

apt-get install -y php8.1-fpm php8.1-cli php8.1-mysql php8.1-pgsql php8.1-curl php8.1-xml php8.1-zip php8.1-intl php8.1-mbstring 
apt-get install -y php8.1-bz2 php8.1-bcmath php8.1-gmp php8.1-ldap php8.1-apcu php8.1-imagick imagemagick
apt-get install -y php8.1-common php8.1-igbinary php8.1-redis php8.1-smbclient php8.1-opcache 
apt-get install -y php8.1-gd php8.1-apcu

Configuration

modifier les configurations suivantes, en connexion sudo:

Dans /etc/php/7.4/fpm/pool.d/www.conf

sed -i "s/;env\[HOSTNAME\] = /env[HOSTNAME] = /" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/;env\[TMP\] = /env[TMP] = /" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/;env\[TMPDIR\] = /env[TMPDIR] = /" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/;env\[TEMP\] = /env[TEMP] = /" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/;env\[PATH\] = /env[PATH] = /" /etc/php/7.4/fpm/pool.d/www.conf

Dans /etc/php/7.4/cli/php.ini

sed -i "s/output_buffering =.*/output_buffering = 'Off'/" /etc/php/7.4/cli/php.ini
sed -i "s/max_execution_time =.*/max_execution_time = 3600/" /etc/php/7.4/cli/php.ini
sed -i "s/max_input_time =.*/max_input_time = 3600/" /etc/php/7.4/cli/php.ini
sed -i "s/post_max_size =.*/post_max_size = 10240M/" /etc/php/7.4/cli/php.ini
sed -i "s/upload_max_filesize =.*/upload_max_filesize = 10240M/" /etc/php/7.4/cli/php.ini
sed -i "s/;date.timezone.*/date.timezone = Europe\/\Paris/" /etc/php/7.4/cli/php.ini

Dans /etc/php/7.4/fpm/php.ini

sed -i "s/memory_limit = 128M/memory_limit = 512M/" /etc/php/7.4/fpm/php.ini
sed -i "s/output_buffering =.*/output_buffering = 'Off'/" /etc/php/7.4/fpm/php.ini
sed -i "s/max_execution_time =.*/max_execution_time = 3600/" /etc/php/7.4/fpm/php.ini
sed -i "s/max_input_time =.*/max_input_time = 3600/" /etc/php/7.4/fpm/php.ini
sed -i "s/post_max_size =.*/post_max_size = 10240M/" /etc/php/7.4/fpm/php.ini
sed -i "s/upload_max_filesize =.*/upload_max_filesize = 10240M/" /etc/php/7.4/fpm/php.ini
sed -i "s/;date.timezone.*/date.timezone = Europe\/\Paris/" /etc/php/7.4/fpm/php.ini
sed -i "s/;session.cookie_secure.*/session.cookie_secure = True/" /etc/php/7.4/fpm/php.ini
sed -i "s/;opcache.enable=.*/opcache.enable=1/" /etc/php/7.4/fpm/php.ini
sed -i "s/;opcache.enable_cli=.*/opcache.enable_cli=1/" /etc/php/7.4/fpm/php.ini
sed -i "s/;opcache.memory_consumption=.*/opcache.memory_consumption=128/" /etc/php/7.4/fpm/php.ini
sed -i "s/;opcache.interned_strings_buffer=.*/opcache.interned_strings_buffer=8/" /etc/php/7.4/fpm/php.ini
sed -i "s/;opcache.max_accelerated_files=.*/opcache.max_accelerated_files=10000/" /etc/php/7.4/fpm/php.ini
sed -i "s/;opcache.revalidate_freq=.*/opcache.revalidate_freq=1/" /etc/php/7.4/fpm/php.ini
sed -i "s/;opcache.save_comments=.*/opcache.save_comments=1/" /etc/php/7.4/fpm/php.ini

Dans /etc/php/7.4/mods-available/apcu.ini

sed -i '$aapc.enable_cli=1' /etc/php/7.4/mods-available/apcu.ini

Dans __/etc/ImageMagick-6/policy.xml__
<code>
sed -i "s/rights=\"none\" pattern=\"PS\"/rights=\"read|write\" pattern=\"PS\"/" /etc/ImageMagick-6/policy.xml
sed -i "s/rights=\"none\" pattern=\"EPI\"/rights=\"read|write\" pattern=\"EPI\"/" /etc/ImageMagick-6/policy.xml
sed -i "s/rights=\"none\" pattern=\"PDF\"/rights=\"read|write\" pattern=\"PDF\"/" /etc/ImageMagick-6/policy.xml
sed -i "s/rights=\"none\" pattern=\"XPS\"/rights=\"read|write\" pattern=\"XPS\"/" /etc/ImageMagick-6/policy.xml

Pour PHP 8.1, remplacer les références de 7.4 par 8.1

Rechargement

Pour prendre en compte les modifications

sudo service php7.4-fpm restart
sudo service php8.1-fpm restart
php_7.3.txt · Dernière modification : 2023/02/07 17:41 de admin