Mac Enable Xdebug in MAMP
Below are the steps necessary to enable Xdebug in MAMP (non-pro version) for Mac.
Step 1: Determine PHP Version
- In MAMP, press
Open start page
- View
phpinfo
to get PHP version - Note which PHP version you have
Step 2: Configure php.ini
MAMP has two configuration files for each PHP version:
/Applications/MAMP/conf/php[version]/php.ini
/Applications/MAMP/bin/php/php[version]/conf/php.ini
- Locate the
xdebug
section at the bottom of both of these files - Uncomment
zend_extension
line in both files (remove the;
) - Add the following lines to the
xdebug
section in both files:
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1 # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
Result should look something like:
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php7.0.8/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1 # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
Step 3: Restart MAMP!
- Restart MAMP and Xdebug should be all set for whatever environment you use!
- Visit the page you desire to debug with
?XDEBUG_SESSION_START=xdebug
appended to the URL.
Published