mac+php+xdebug
1,下载xdebug
2,进入xdebug-2.4.0RC4目录,运行phpize命令,
2,google之后说要安装autoconf
brew install autoconf
3,但是使用brew无法找到些命令,于是安装brew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
安装完brew之后,执行brew install autoconf
4,安装完之后在xdebug-2.4.0RC4目录下:
./configure
make
5,这里会报以下错误
/Users/slin/tools/xdebug-2.4.0RC4/xdebug.c:25:10: fatal error: 'php.h' file not
found
#include "php.h"
^
1 error generated.
make: *** [xdebug.lo] Error 1
6,找了半天原因,是/usr下没有include 目录,这个目录就是sudo 也无法创建,会报权限不够,由于这个目录的不存在,所以phpize命令也是无法正常执行,一通搜索过后,终于有人说安装command lines tools(这里在控制台使用xcode-select --install命令就可以安装了)之后就可以解决,当我安装了之后发现/user下出现了include目录,执行make 正常,执行phpize正常,xdebug安装成功,你会发现xdebug目录下的modules目录下会有xdebug.so生成,同时/usr/lib/php/extensions/no-debug-non-zts-20121212/目录下也会有xdebug.so生成
7.配置php.ini(cp /etc/php.ini.default /etc/php.ini),在最后加上以下配置
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_connect_back=1
xdebug.remote_host=myphp
xdebug.remote_port=9000
xdebug.profiler_enable=on
xdebug.remote_enable=on //这里必须有啊
xdebug.remote_autostart=on
xdebug.profiler_output_dir="/Users/slin/log/xdebug"
xdebug.idekey=netbeans-xdebug
8.配置intellJ idea 中 Preferences ->Language & framework->PHP
->Debug
->DBPg Proxy
->Server
9,在Edit Configurations 中添加PHP Web Applications
10,配置完成,设置断点,访问网站,最好在index.php中
<?php phpinfo(); ?>使用phpinfo函数查看xdebug是否配置正常