Installation avec Brew.
Arrêter le Apache natif de macOS:
sudo apachectl stop
Installer Apache avec Homebrew:
brew install httpd
Lancer le service Apache:
brew services start https
En allant sur http://localhost:8080, il devrait s'afficher le classique It works !.
Modifier le fichier /usr/local/etc/httpd/httpd.conf:
Listen 8080 par Listen 80deflate_module et rewrite_module.User par le login de l'utilisateur actuelGroup par staffDocumentRoot et le Directory juste en-dessous par un chemin qui convientRedémarrer Apache:
sudo apachectl restart
Tout devrait fonctionner en allant sur http://localhost.
brew install php@7.2
Dans le fichier /usr/local/etc/httpd/httpd.conf, ajouter le module PHP7, à la fin de la liste des modules:
LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so
Dans ce même fichier, remplacer
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
par
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Démarrer le service PHP:
brew services start php@7.2
Redémarrer Apache:
sudo apachectl restart
Tout devrait fonctionner en allant sur une page PHP.
echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.zshrc echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.zshrc