macOS - localhost
Activer le serveur PHP de macOS pour Big Sur
Since iWeb (2006) macOS has an embedded PHP server which is still present but not activated. Activating it offers a localhost without the need of installing MAMP.app or similar.
The following page gives the procedure for Catalina. It also works for Big Sur but at the expense of few adaptations.
discussions.apple.com/docs/DOC-250001766
1- Go to “/etc/apache2" with Go/Go to folder…
Edit the file: httpd.conf
Uncomment lines: 184, 187, 188, 521 (+1 offset with respect with the Catalina version)
2- Go to "/etc/apache2/extra"
Edit the file: httpd-userdir.conf
Uncomment line 16
3- In Terminal.app
apachectl configtest
—> "Syntax OK"
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
4- With Big Sur two more command must be added
sudo apachectl stop
sudo apachectl start
5- Verification
Now try PHP. Create a PHP info file with the Terminal command:
echo "<?php echo phpinfo(); ?>" > ~/Sites/info.php
And test it by entering the following into Safari's address bar:
localhost/~<your short user name>/info.php