Mise à jour avec version 7.4 (Bullseye)

This commit is contained in:
Gregory Colpart 2024-02-07 21:26:36 +01:00
parent 05a7326707
commit abed14c677

View file

@ -141,19 +141,21 @@ PHP avec [Apache](HowtoApache) ou [Nginx](HowtoNginx).
~~~ ~~~
# apt install php php-fpm # apt install php php-fpm
# systemctl status php7.3-fpm # systemctl status php7.4-fpm
● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager ● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled) Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-06-27 19:42:26 CEST; 1h 41min ago Active: active (running) since Wed 2024-02-07 21:21:49 CET; 38s ago
Docs: man:php-fpm7.3(8) Docs: man:php-fpm7.4(8)
Main PID: 7213 (php-fpm7.3) Process: 241270 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)
Status: "Processes active: 3, idle: 199, Requests: 197051, slow: 0, Traffic: 30.7req/sec" Main PID: 241267 (php-fpm7.4)
Tasks: 203 (limit: 4915) Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
Memory: 1.9G Tasks: 3 (limit: 18761)
CGroup: /system.slice/php7.3-fpm.service Memory: 11.2M
├─ 712 php-fpm: pool front CPU: 37ms
├─ 725 php-fpm: pool front CGroup: /system.slice/php7.4-fpm.service
... ├─241267 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
├─241268 php-fpm: pool www
└─241269 php-fpm: pool www
~~~ ~~~
> *Note* : Pour Debian 8, il faut installer ainsi : > *Note* : Pour Debian 8, il faut installer ainsi :
@ -183,21 +185,21 @@ PHP avec [Apache](HowtoApache) ou [Nginx](HowtoNginx).
Fichiers de configuration : Fichiers de configuration :
~~~ ~~~
/etc/php/7.3/ /etc/php/7.4/
├── apache2 ├── apache2
│   ├── conf.d │   ├── conf.d
│   │   ├── [...] │   │   ├── [...]
│   │   └── 20-xsl.ini -> /etc/php/7.3/mods-available/xsl.ini │   │   └── 20-xsl.ini -> /etc/php/7.4/mods-available/xsl.ini
│   └── php.ini │   └── php.ini
├── cli ├── cli
│   ├── conf.d │   ├── conf.d
│   │   ├── [...] │   │   ├── [...]
│   │   └── 20-xsl.ini -> /etc/php/7.3/mods-available/xsl.ini │   │   └── 20-xsl.ini -> /etc/php/7.4/mods-available/xsl.ini
│   └── php.ini │   └── php.ini
├── fpm ├── fpm
│   ├── conf.d │   ├── conf.d
│   │   ├── [...] │   │   ├── [...]
│   │   └── 20-xsl.ini -> /etc/php/7.3/mods-available/xsl.ini │   │   └── 20-xsl.ini -> /etc/php/7.4/mods-available/xsl.ini
│   ├── php-fpm.conf │   ├── php-fpm.conf
│   ├── php.ini │   ├── php.ini
│   └── pool.d │   └── pool.d
@ -210,17 +212,17 @@ Fichiers de configuration :
On peut valider une configuration ainsi : On peut valider une configuration ainsi :
~~~ ~~~
# php-fpm7.3 -t # php-fpm7.4 -t
[27-Jun-2023 21:24:58] NOTICE: configuration file /etc/php/7.3/fpm/php-fpm.conf test is successful [07-Feb-2024 21:24:54] NOTICE: configuration file /etc/php/7.4/fpm/php-fpm.conf test is successful
~~~ ~~~
### Configuration de base (php.ini) ### Configuration de base (php.ini)
Il existe un fichier `php.ini` distinct suivant lutilisation de Il existe un fichier `php.ini` distinct suivant lutilisation de
PHP : cli, mod_php et FPM. PHP : cli, mod_php et FPM.
Par exemple `/etc/php/7.3/fpm/php.ini` pour FPM. Par exemple `/etc/php/7.4/fpm/php.ini` pour FPM.
Le fichier `/etc/php/7.3/fpm/conf.d/z-evolinux-defaults.ini` contient Le fichier `/etc/php/7.4/fpm/conf.d/z-evolinux-defaults.ini` contient
nos optimisations basiques : nos optimisations basiques :
~~~ ~~~
@ -236,7 +238,7 @@ open_basedir = /home
disable_functions = exec, shell-exec, system, passthru, putenv, popen disable_functions = exec, shell-exec, system, passthru, putenv, popen
~~~ ~~~
Le fichier `/etc/php/7.3/fpm/conf.d/zzz-evolinux-custom.ini` contient nos optimisations spécifiques. Le fichier `/etc/php/7.4/fpm/conf.d/zzz-evolinux-custom.ini` contient nos optimisations spécifiques.
### Configuration FPM ### Configuration FPM
@ -244,17 +246,17 @@ Voici les directives de base :
~~~ ~~~
[global] [global]
pid = /run/php/php7.3-fpm.pid pid = /run/php/php7.4-fpm.pid
error_log = /var/log/php7.3-fpm.log error_log = /var/log/php7.4-fpm.log
rlimit_files = 65536 rlimit_files = 65536
~~~ ~~~
On définit ensuite un ou plusieurs *pools* FPM via On définit ensuite un ou plusieurs *pools* FPM via
`/etc/php/7.3/fpm/pool.d/*.conf` : `/etc/php/7.4/fpm/pool.d/*.conf` :
~~~ ~~~
[www] [www]
listen = /run/php/php7.3-fpm.sock listen = /run/php/php7.4-fpm.sock
;listen = 127.0.0.1:9000 ;listen = 127.0.0.1:9000
user = www-data user = www-data
group = www-data group = www-data
@ -349,7 +351,7 @@ On configure FPM avec Apache, par exemple dans un VirtualHost :
~~~{.apache} ~~~{.apache}
DocumentRoot /home/bench/www/ DocumentRoot /home/bench/www/
#ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000//home/foo/www/$1" #ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000//home/foo/www/$1"
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php7.3-fpm.sock|fcgi://localhost/home/foo/www/" ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost/home/foo/www/"
~~~ ~~~
### Configuration mod_php ### Configuration mod_php
@ -549,7 +551,7 @@ Exceptionnellement, s'il est nécessaire d'installer Composer globalement :
# curl -Lo /etc/apt/trusted.gpg.d/php-phalcon.asc https://packagecloud.io/phalcon/stable/gpgkey # curl -Lo /etc/apt/trusted.gpg.d/php-phalcon.asc https://packagecloud.io/phalcon/stable/gpgkey
# chmod 644 /etc/apt/trusted.gpg.d/php-phalcon.asc # chmod 644 /etc/apt/trusted.gpg.d/php-phalcon.asc
# apt update # apt update
# apt install php7.3-psr php7.3-phalcon # apt install php7.4-psr php7.4-phalcon
# php -m | grep phalcon # php -m | grep phalcon
phalcon phalcon
``` ```