MAMP下phpstorm配置xdebug

时间:2024-04-06 07:58:04

MAMP默认没有开启XDebug,如何开启它呢?
注意MAMP对于特定版本的php有两个配置文件!!这一点比较坑。你需要编辑两个文件:

/Applications/MAMP/conf/php[version]/php.ini
/Applications/MAMP/bin/php/php[version]/conf/php.ini

在这两个文件中,先翻到最底部,把[xdebug]部分第一行去掉注释,再在后面加上:

xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1    # Not safe for production servers
xdebug.remote_port=80
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true

MAMP下phpstorm配置xdebug


配置phpstorm的php路径,phpstorm会自动解析xdebug版本。
现在就可以用phpstorm来进行debug了:
MAMP下phpstorm配置xdebug

problem to solve

重启MAMP,发现phpinfo()中并没有搜索到xdebug
先挖个坑,后面解决这个问题。