Curl errors and no cli commands in Windows

Having installed GRAV on Windows 10 and started using Mamp I ran into the problem documented elsewhere that I couldn’t run cli commands like gpm and plungin because of the folloing error:

FATAL: DEVTOOLS requires PHP Curl module to be installed

This problem has been discussed elsewhere on the forums (ref. Unable to use cli commands, keep getting Curl Errors). It took me a while to join the dots and solve so I’m posting the solution I found.

Searching the forums, I located the php.ini file for the server (make a php script with <?php phpinfo() ?> and run it in your browser, find “loaded configuration file” and read off the location for php.ini). I checked this file, and the extension=php_curl.dll line was uncommented. This was confirmed further down on the php info page in the browser I just called up in the browser - cURL support was enabled. So I was puzzled as to why the error was occuring.

However, at the command line running, php -m, curl was not listed.

Eventually I foung the problem: there are two php environments - one for the browser associated with the local server and another for the command line. Then I found a solution:

I ran the command: php --ini. This returned the php.ini path (in my case C:\Windows). As there was no configuration file loaded, I just copied the php.ini file I’d been looking at above to this location and the problem was resolved.