Petit billet de mise à jour pour Lion

sh-3.2# apachectl -v
Server version: Apache/2.2.19 (Unix)
Server built:   Jun 16 2011 22:09:54

sh-3.2# php -v
PHP 5.3.6 with Suhosin-Patch (cli) (built: Jun 16 2011 22:26:57) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

Les versions ne sont pas à la traine et ça c'est bien !

Pour activer PHP, je commence par configurer le mot de passe root (on peut jouer avec les sudo mais ça me gonfle ;-))

MacProCyb:~ Cyb$ sudo passwd root
Changing password for root.
New password:
Retype new password:

On passe root :

MacProCyb:~ Cyb$ su 
Password:
sh-3.2# whoami
root

On regarde les droits dans le dossier de config d'apache :

sh-3.2# cd /etc/apache2/
sh-3.2# ls -l
total 96
drwxr-xr-x  13 root  wheel    442 17 jui 07:11 extra
-r--r--r--   1 root  wheel  24330 23 sep 20:26 httpd.conf
-r--r--r--   1 root  wheel  24330 23 sep 20:26 httpd.conf.default
-rw-r--r--   1 root  wheel    485 23 sep 20:26 httpd_ACSServer.conf
-rw-r--r--   1 root  wheel   3699 23 sep 20:26 httpd_devicemanagement.conf
-rw-r--r--   1 root  wheel     62 23 sep 20:26 httpd_podcastlibrary.conf
-rw-r--r--   1 root  wheel  12958 23 sep 20:26 magic
-rw-r--r--   1 root  wheel  50020 23 sep 20:26 mime.types
drwxr-xr-x   4 root  wheel    136 17 jui 07:11 original
drwxr-xr-x   4 root  wheel    136 17 jui 07:11 other
drwxr-xr-x   3 root  wheel    102 24 sep 01:21 users
drwxr-xr-x   6 root  wheel    204 23 sep 20:26 webapps

On voit que httpd.conf est en lecture seule. On le passe en écriture pour le root :

sh-3.2# chmod +w httpd.conf
sh-3.2# ls -l
total 96
drwxr-xr-x  13 root  wheel    442 17 jui 07:11 extra
-rw-r--r--   1 root  wheel  24330 23 sep 20:26 httpd.conf
-r--r--r--   1 root  wheel  24330 23 sep 20:26 httpd.conf.default

Ok. Maintenant on peut le modifier :

sh-3.2# vi httpd.conf

Il faut chercher la ligne suivante et la décommenter :

#LoadModule php5_module libexec/apache2/libphp5.so

Après avoir enregistré, on redémarre Apache. Soit par l'interface graphique (Préférence/Partage/) en décochant puis recochant "Partage Web". Soit en ligne de commande :

sh-3.2# apachectl restart

On créé un petit fichier de test :

echo "<?php echo phpinfo(); ?>" > /Library/WebServer/Documents/info.php

http://127.0.0.1/info.php

A vous de jouer !

PS : fonctionne aussi dans votre dossier personnel si vous l'avez activé.