Externaliser votre configuration PHP

Depuis les dernières version de PHP 5 (et PHP 4?) disponibles dans Debian/Ubuntu, un petit répertoire conf.d est apparu dans /etc/php5 :

nicolas@tetram:/etc/php5$ ls -alR
.:
total 20
drwxr-xr-x   5 root root 4096 2007-06-08 20:47 .
drwxr-xr-x 112 root root 4096 2007-06-13 08:44 ..
drwxr-xr-x   2 root root 4096 2007-06-08 20:51 apache2
drwxr-xr-x   2 root root 4096 2007-06-08 20:51 cli
drwxr-xr-x   2 root root 4096 2007-06-08 20:51 conf.d

./apache2:
total 52
drwxr-xr-x 2 root root  4096 2007-06-08 20:51 .
drwxr-xr-x 5 root root  4096 2007-06-08 20:47 ..
lrwxrwxrwx 1 root root     9 2007-06-08 20:46 conf.d -> ../conf.d
-rw-r--r-- 1 root root 43433 2007-06-08 20:51 php.ini

./cli:
total 52
drwxr-xr-x 2 root root  4096 2007-06-08 20:51 .
drwxr-xr-x 5 root root  4096 2007-06-08 20:47 ..
lrwxrwxrwx 1 root root     9 2007-06-08 20:47 conf.d -> ../conf.d
-rw-r--r-- 1 root root 43435 2007-06-08 20:51 php.ini

./conf.d:
total 28
drwxr-xr-x 2 root root 4096 2007-06-08 20:51 .
drwxr-xr-x 5 root root 4096 2007-06-08 20:47 ..
-rw-r--r-- 1 root root   50 2007-05-22 21:06 gd.ini
-rw-r--r-- 1 root root   57 2007-05-22 21:06 mysqli.ini
-rw-r--r-- 1 root root   56 2007-05-22 21:06 mysql.ini
-rw-r--r-- 1 root root   52 2007-05-22 21:06 pdo.ini
-rw-r--r-- 1 root root   60 2007-05-22 21:06 pdo_mysql.ini

Si vous installer APC, ]r exil vous faut normalement ajouter la ligne suivante dans votre/vos fichier(s) php.ini

extension = apc.so

Maintenant, plus besoin d’éditer vos fichiers php.ini. Il vous suffit de créer un fichier apc.ini dans /etc/php5/conf.d contenant la ligne suivante et le tour est joué :

extension = apc.so

Et ainsi le module APC (dans notre exemple) est disponible (dans mon cas) pour php utilisé avec apache2 et php en ligne de commande.