最近新买了一份,重新配置phpstormxdebug,方便调试,提高调试效率。现在brewinstallphp@7.2可以指定版本,安装extensions的方式完全不能用,所以下载源码编译下载xdebug官网:https://xdebug.org/download.php下载最稳定的版本[version2.6.1][1]编译源码phpize./configure--with-php-config=/usr/local/Cellar/php@7.2/7.2.16/bin/php-configmake&&makeinstall安装sharedextensions:/usr/local/Cellar/php@7.2/7.2.16/pecl/20170718/被编译到这个目录下,实际上是软链接到/usr/local/lib/php/pecl在/usr/local配置xdebug/etc/php/7.2/conf.d新建ext-xdebug.ini并写入[xdebug]zend_extension="/usr/local/lib/php/pecl/20170718/xdebug.so"xdebug.remote_enable=Onxdebug.remote_connect_back=1xdebug.remote_port=6677xdebug.remote_log=/usr/local/var/log/xdebug.logxdebug.idekey=PHPSTORMxdebug.idekey=mykeyidekey,用于标识调试会话xdebug.remote_autostart是否自动启动,1:自动,0:需要设置http请求参数或者cookie规范,默认0,根据需要设置这个值。我个人建议设置为1,这样就不需要为每个需要调试的接口修改请求参数xdebug.remote_enable=on。是否开启远程调试xdebug.remote_host=172.16.10.103远程主机IP,即PHPStorm所在的机器(PHPStorm作为xdebug客户端),没有固定IP的机器建议使用connect_back选项。xdebug.remote_connect_back=on是否连接回发送请求的主机。如果PHPStorm所在机器IP经常变化(DHCP环境),建议启用该选项xdebug.remote_port=10000远程主机端口,即开发者机器端口xdebug.idekey=PHPSTROM与phpstorm通信重启php即可查看是否安装成功/usr/local/etc/php/7.2/conf.dphp-m|grepxdebug完成!!开始配置phpstorm,设置端口,设置服务器,配置调试配置,访问url?XDEBUG_SESSION_START=PHPSTORM搞定哈哈哈,配色有点夸张,还没调整
