Skip to content

Instantly share code, notes, and snippets.

@fosron
Last active September 21, 2017 09:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fosron/5cee8d09aee1a9c42d804c8aefc605ea to your computer and use it in GitHub Desktop.
Save fosron/5cee8d09aee1a9c42d804c8aefc605ea to your computer and use it in GitHub Desktop.
XDebug and MAMP

Instructions

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.

FAQ

  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment