您好,欢迎访问一九零五行业门户网

MAC+PhpStorm环境中安装Xdebug

xdebug是一个强大的php程序调试器。对于php开发者来说,xdebug是必备工具。本文就以mac为基础环境,来进行xdebug的安装以及phpstorm配置。
安装xdebug
使用brew安装xdebug,语法如下
brew install homebrew/php/php<version number>-xdebug
到https://xdebug.org/download.php下载xdebug,版本必须是与php对应的版本
brew install homebrew/php/php56-xdebug
如果你不知道该下载哪个版本的xdebug,xdebug网站有可以检测的地方,把你的phpinfo()信息整个复制到文本框内,然后点击analyse my phpinfo() output按钮,就会有相应的安装过程介绍。
查看现有php版本
$ php -vphp 5.6.32 (cli) (built: oct 27 2017 11:56:18) copyright (c) 1997-2016 the php groupzend engine v2.6.0, copyright (c) 1998-2016 zend technologies with xdebug v2.5.5, copyright (c) 2002-2017, by derick rethans
下载完成后,解压压缩文件。把解压后的文件目录,整个复制到/usr/local/cellar/php56/5.6.32_8/目录下
$ cd /usr/local/cellar/php56/5.6.32_8/$ phpize
若出现以下信息,则表示可以继续下一步
configuring for:php api version: 20131106 zend module api no: 20131226 zend extension api no: 220131226
继续走流程
$ ./configure$ make$ cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20131226
最后创建/etc/php.ini文件
vi /etc/php.ini
添加这一行
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
重启web服务器
apachectl restart
使用phpinfo查看是否安装成功
<?php phpinfo(); ?>
虽然/etc/php.ini的都有默认配置,但这几个配置最好写一下
xdebug.remote_enable = onxdebug.remote_handler = dbgp xdebug.remote_host= localhost xdebug.remote_port = 9000xdebug.idekey = phpstorm
phpstorm-配置xdebug
打开phpstorm,查看xdebug的基本信息
这里的端口需要与/etc/php.ini里xdebug.remote_port的端口一致
点击edit configurations
新建php web application
配置基本信息
配置server
至此,完成!
相关推荐:
phpstorm快捷键介绍总结
浅述php7的安装调试工具xdebug扩展的方法
如何使用 xdebug + sublime text 3 调试 php 代码
以上就是mac+phpstorm环境中安装xdebug的详细内容。
其它类似信息

推荐信息