Files
varlog/dcb36f50-d319-40a9-910d-745d2f005300/index.md
T
2026-05-15 10:37:48 +02:00

47 lines
1020 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Accélérer lexécution des pages avec memcached
## Installer memcached
Installer **memcached** pour PHP 7.4 :
```BASH
sudo apt install php7.4-memcached memcached
```
Installer **memcached** pour PHP 8.0 :
```BASH
sudo apt install php8.0-memcached memcached
```
## Vérifier le fonctionne de memcached dans le system
ps ax | grep memcached
Résultat
```
14085 ? Ssl 0:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid
```
## Paramétrer memcached dans php
Il faut ajouter des paramètres dans la configuration de PHP. J'ai dédié un fichier de paramétrage `sudo nano /etc/php/7.4/fpm/conf.d/20-apcu.ini`
```
extension=apcu.so
apc.enabled=1
apc.shm_size=256M
apc.ttl=7200
apc.enable_cli=1
apc.gc_ttl=3600
apc.entries_hint=4096
apc.slam_defense=1
apc.serializer=php
```
## Vérifier le fonctionne de memcached par php
Pour vérifier la prise en compte, il suffit de demande à phpinfo().
```PHP
<?php
phpinfo();
?>
```
![](20201230-155201.png)