Sur macOS, j'administre mon site WEB constitué de fichiers au format PHP avec du code HTML5 et PHP avec VSCODIUM. J'ai obtenu l'erreur suivante
lorsque j'enregistrais mes modifications :
01/11/2024 18:54:39 [ERROR] Format failed
01/11/2024 18:54:39 [ERROR] phpfmt: Error getting php version
01/11/2024 18:55:42 [INFO] settings reloaded
01/11/2024 18:56:52 [INFO] settings reloaded
01/11/2024 18:58:12 [INFO] settings reloaded
01/11/2024 18:59:33 [ERROR] getting php version failed
01/11/2024 18:59:33 [ERROR] Command failed: php -v
/bin/sh: php: command not found
Cela signifie que l'application PHP n'est pas installé sur l'ordinateur.
$ brew install php
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/opt/homebrew/etc/php/8.3/
To start php now and restart at login:
$ brew services start php
==> Tapping homebrew/services
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 3487, done.
remote: Counting objects: 100% (633/633), done.
remote: Compressing objects: 100% (248/248), done.
remote: Total 3487 (delta 451), reused 477 (delta 381), pack-reused 2854 (from 1)
Receiving objects: 100% (3487/3487), 1020.00 KiB | 1.90 MiB/s, done.
Resolving deltas: 100% (1691/1691), done.
Tapped 2 commands (52 files, 1.2MB).
==> Successfully started `php` (label: homebrew.mxcl.php)
$ php -v
PHP 8.3.13 (cli) (built: Oct 22 2024 18:39:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.13, Copyright (c) Zend Technologies
with Zend OPcache v8.3.13, Copyright (c), by Zend Technologies