1.下载xdebug文件
http://xdebug.org/wizard.php
将phpinfo()的源代码复制到文本框中,xdebug会提示如何配置和下载哪个版本的xdebug。
全部下载地址:
http://www.xdebug.org/download.php
instructionsdownload xdebug-2.3.3.tgzunpack the downloaded file with tar -xvzf xdebug-2.3.3.tgzrun: cd xdebug-2.3.3run: phpize (see the faq if you don't have phpize.as part of its output it should show:configuring for:...zend module api no: 20121212zend extension api no: 220121212if it does not, you are using the wrong phpize. please follow this faq entry and skip the next step.run: ./configurerun: makerun: cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20121212edit /etc/php.ini and add the linezend_extension = /usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.sorestart the webserver
在xdebug官网会有许多安装提示。其中可能会出现的问题有:
phpize没有安装:继而又要安装brew,再安装autoconf可谓一波三折
2.解决相关组件不全的问题
问题描述mac系统升级到10.9(mavericks)时安装php扩展,执行 phpize 提示如下错误:cannot find autoconf. please check your autoconf installationand the $php_autoconf environment variable.解决办法先安装homebrew:如果以下链接失效的话,可以到brew官网查看。http://brew.sh/
ruby -e $(curl -fssl https://raw.githubusercontent.com/homebrew/install/master/install)
然后安装 autoconf:brew install autoconf
3.配置php.ini
在xdebug官网上的配置,只能够正确配置好xdebug但是不能与phpstorm进行配置。在php.ini末尾加上如下代码:
[xdebug]zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.soxdebug.remote_enable = onxdebug.remote_handler = dbgpxdebug.remote_host = localhostxdebug.remote_port = 9000xdebug.idekey = phpstrom
4.配置phpstorm
打开phpstorm,
-进入file>settings>php>servers,这里要填写服务器端的相关信息,name填localhost,host填localhost,port填80,debugger选xdebug
-进入file>settings>php>debug,看到xdebug选项卡,port填9000,其他默认
-进入file>settings>php>debug>dbgp proxy,ide key 填 phpstorm,host 填localhost,port 填80
-点ok退出设置。
在phpstorm里打开监听(电话按钮)。
5.chrome的xdebug配置
在ide key里将其配置成“phpstorm”
项目地址:https://github.com/mac-cain13/xdebug-helper-for-chrome
好了,到此就可以配置完成了,有问题的话可以给我留言,大家一起交流。
6.其他:
重启apache
sudo apachectl restart
修改php.ini权限
sudo chmod 0777 php.ini
编辑php.ini文件
sudo vi php.ini(修改i,退出:q,保存退出:wq)