Mise à jour avec version 7.4 (Bullseye)
This commit is contained in:
parent
05a7326707
commit
abed14c677
58
HowtoPHP.md
58
HowtoPHP.md
|
@ -141,19 +141,21 @@ PHP avec [Apache](HowtoApache) ou [Nginx](HowtoNginx).
|
|||
~~~
|
||||
# apt install php php-fpm
|
||||
|
||||
# systemctl status php7.3-fpm
|
||||
● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager
|
||||
Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled)
|
||||
Active: active (running) since Tue 2023-06-27 19:42:26 CEST; 1h 41min ago
|
||||
Docs: man:php-fpm7.3(8)
|
||||
Main PID: 7213 (php-fpm7.3)
|
||||
Status: "Processes active: 3, idle: 199, Requests: 197051, slow: 0, Traffic: 30.7req/sec"
|
||||
Tasks: 203 (limit: 4915)
|
||||
Memory: 1.9G
|
||||
CGroup: /system.slice/php7.3-fpm.service
|
||||
├─ 712 php-fpm: pool front
|
||||
├─ 725 php-fpm: pool front
|
||||
...
|
||||
# systemctl status php7.4-fpm
|
||||
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
|
||||
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
|
||||
Active: active (running) since Wed 2024-02-07 21:21:49 CET; 38s ago
|
||||
Docs: man:php-fpm7.4(8)
|
||||
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)
|
||||
Main PID: 241267 (php-fpm7.4)
|
||||
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
|
||||
Tasks: 3 (limit: 18761)
|
||||
Memory: 11.2M
|
||||
CPU: 37ms
|
||||
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 :
|
||||
|
@ -183,21 +185,21 @@ PHP avec [Apache](HowtoApache) ou [Nginx](HowtoNginx).
|
|||
Fichiers de configuration :
|
||||
|
||||
~~~
|
||||
/etc/php/7.3/
|
||||
/etc/php/7.4/
|
||||
├── apache2
|
||||
│ ├── 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
|
||||
├── cli
|
||||
│ ├── 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
|
||||
├── fpm
|
||||
│ ├── 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.ini
|
||||
│ └── pool.d
|
||||
|
@ -210,17 +212,17 @@ Fichiers de configuration :
|
|||
On peut valider une configuration ainsi :
|
||||
|
||||
~~~
|
||||
# php-fpm7.3 -t
|
||||
[27-Jun-2023 21:24:58] NOTICE: configuration file /etc/php/7.3/fpm/php-fpm.conf test is successful
|
||||
# php-fpm7.4 -t
|
||||
[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)
|
||||
|
||||
Il existe un fichier `php.ini` distinct suivant l’utilisation de
|
||||
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 :
|
||||
|
||||
~~~
|
||||
|
@ -236,7 +238,7 @@ open_basedir = /home
|
|||
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
|
||||
|
||||
|
@ -244,17 +246,17 @@ Voici les directives de base :
|
|||
|
||||
~~~
|
||||
[global]
|
||||
pid = /run/php/php7.3-fpm.pid
|
||||
error_log = /var/log/php7.3-fpm.log
|
||||
pid = /run/php/php7.4-fpm.pid
|
||||
error_log = /var/log/php7.4-fpm.log
|
||||
rlimit_files = 65536
|
||||
~~~
|
||||
|
||||
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]
|
||||
listen = /run/php/php7.3-fpm.sock
|
||||
listen = /run/php/php7.4-fpm.sock
|
||||
;listen = 127.0.0.1:9000
|
||||
user = www-data
|
||||
group = www-data
|
||||
|
@ -349,7 +351,7 @@ On configure FPM avec Apache, par exemple dans un VirtualHost :
|
|||
~~~{.apache}
|
||||
DocumentRoot /home/bench/www/
|
||||
#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
|
||||
|
@ -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
|
||||
# chmod 644 /etc/apt/trusted.gpg.d/php-phalcon.asc
|
||||
# apt update
|
||||
# apt install php7.3-psr php7.3-phalcon
|
||||
# apt install php7.4-psr php7.4-phalcon
|
||||
# php -m | grep phalcon
|
||||
phalcon
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue