Prochaine révision | Révision précédente |
php_7.3 [2020/05/15 17:15] – créée admin | php_7.3 [2023/02/07 17:41] (Version actuelle) – [Rechargement] admin |
---|
====== PHP 7.3 ====== | ====== PHP 7.4 & 8.1 ====== |
| |
Installation de PHP 7.3 sous debian 9 ou 10 avec pris en charge de fpm. | Installation de PHP 7.4 et 8.1 sous debian 10 avec pris en charge de fpm. |
| |
===== Packages ===== | ===== Packages ===== |
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list | echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list |
apt-get update | apt-get update |
apt-get install -y php7.3-fpm php7.3-cli php7.3-gd php7.3-mysql php7.3-pgsql php7.3-curl php7.3-xml php7.3-zip php7.3-intl php7.3-mbstring php7.3-json php7.3-bz2 php7.3-ldap php-apcu imagemagick php-imagick php-smbclient | </code> |
| |
| Pour PHP 7.4 |
| <code> |
| 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 |
| </code> |
| |
| Pour PHP 8.1 |
| <code> |
| 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 |
</code> | </code> |
| |
modifier les configurations suivantes, en connexion ''sudo'': | modifier les configurations suivantes, en connexion ''sudo'': |
| |
Dans __/etc/php/7.3/fpm/pool.d/www.conf__ | Dans __/etc/php/7.4/fpm/pool.d/www.conf__ |
<code> | <code> |
sed -i "s/;env\[HOSTNAME\] = /env[HOSTNAME] = /" /etc/php/7.3/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.3/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.3/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.3/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.3/fpm/pool.d/www.conf | sed -i "s/;env\[PATH\] = /env[PATH] = /" /etc/php/7.4/fpm/pool.d/www.conf |
</code> | </code> |
| |
Dans __/etc/php/7.3/cli/php.ini__ | Dans __/etc/php/7.4/cli/php.ini__ |
<code> | <code> |
sed -i "s/output_buffering =.*/output_buffering = 'Off'/" /etc/php/7.3/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.3/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.3/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.3/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.3/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.3/cli/php.ini | sed -i "s/;date.timezone.*/date.timezone = Europe\/\Paris/" /etc/php/7.4/cli/php.ini |
</code> | </code> |
| |
Dans __/etc/php/7.3/fpm/php.ini__ | Dans __/etc/php/7.4/fpm/php.ini__ |
<code> | <code> |
sed -i "s/memory_limit = 128M/memory_limit = 512M/" /etc/php/7.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/fpm/php.ini | sed -i "s/;opcache.save_comments=.*/opcache.save_comments=1/" /etc/php/7.4/fpm/php.ini |
</code> | </code> |
| |
Dans __/etc/php/7.3/mods-available/apcu.ini__ | Dans __/etc/php/7.4/mods-available/apcu.ini__ |
<code> | <code> |
sed -i '$aapc.enable_cli=1' /etc/php/7.3/mods-available/apcu.ini | sed -i '$aapc.enable_cli=1' /etc/php/7.4/mods-available/apcu.ini |
| |
Dans __/etc/ImageMagick-6/policy.xml__ | Dans __/etc/ImageMagick-6/policy.xml__ |
sed -i "s/rights=\"none\" pattern=\"XPS\"/rights=\"read|write\" pattern=\"XPS\"/" /etc/ImageMagick-6/policy.xml | sed -i "s/rights=\"none\" pattern=\"XPS\"/rights=\"read|write\" pattern=\"XPS\"/" /etc/ImageMagick-6/policy.xml |
</code> | </code> |
| |
| //Pour PHP 8.1, remplacer les références de **7.4** par **8.1**// |
| |
| |
===== Rechargement ===== | ===== Rechargement ===== |
Pour prendre en compte les modifications | Pour prendre en compte les modifications |
| |
<code>sudo service php7.3-fpm restart</code> | <code>sudo service php7.4-fpm restart</code> |
| |
| <code>sudo service php8.1-fpm restart</code> |