How to set up VS Code to use MAMP's own PHP?

All MAMP discussions around troubleshooting and anything related to MAMP. Be as detailed as possible here when posting an issue.
Post Reply
Posts: 1
Joined: Sat Mar 05, 2022 11:27 am

How to set up VS Code to use MAMP's own PHP?

Post by robertandrews »

MacOS Monterey does not come with PHP. I know I could install it. But I also use MAMP, which includes its own version/s of PHP.

Visual Studio Code needs to know the location of PHP, for example, for serving projects into the web browser.

MAMP comes with several versions of PHP, eg. `/Applications/MAMP/bin/php/php7.4.21/bin/php`

In VS Code settings (`~/Library/Application Support/Code/User/settings.json`), I'm aware of two relevant settings:

* `phpserver.ip` (starts blank)
* `php.validate.executablePath` (starts missing, guided to add: *"Cannot validate since a PHP installation could not be found. Use the setting 'php.validate.executablePath' to configure the PHP executable."*)

But, when I add `/Applications/MAMP/bin/php/php7.4.21/bin/php` to either of them, it doesn't seem to go right, even with the MAMP server started.

When trying to serve the page in PHP Server, the notice "PHP not found" appears.
Post Reply