Comment out anything xdebug related (except the extension itself) from your CLI ini File (MAMP has 2 different files for CLI and Apache), find the file with:
php -i | grep "Loaded Configuration"
Add this to ~/.bash_profile
export MAMP_PHP=/Applications/MAMP/bin/php/php5.6.30/bin
export PATH="$MAMP_PHP:$PATH"
alias phpx="php -d xdebug.remote_enable=1 -d xdebug.idekey=PHPSTORM -d xdebug.remote_autostart=1 -d xdebug.remote_connect_back=1"
alias phpp="php -d xdebug.profiler_enable=1"
Reload bash_profile
source ~/.bash_profile
Now test which PHP your'e using
which php
or php -v
Now if you want to use behat/xdebug, just do phpx vendor/bin/xdebug
, etc.
-
Why the hardcoded version of PHP ? All the solutions found are using sorting, and this makes php7 the default.
I'm using
alias php7=/Applications/MAMP/bin/php/php7.0.15/bin/php alias php71=/Applications/MAMP/bin/php/php7.1.1/bin/php
In .bash_profile, it requires updating of PHP version with MAMP updates, but i've found no better or faster way.