1、下载Xdebug源码
http://www.xdebug.org/download.php
2、安装xdebug目录下README文件安装
1. Unpack the tarball: tar -xzf xdebug-2.2.x.tgz. Note that you do
not need to unpack the tarball inside the PHP source code tree.
Xdebug is compiled separately, all by itself, as stated above.
2. cd xdebug-2.2.x
3. Run phpize: phpize
(or /path/to/phpize if phpize is not in your path).
4. ./configure --enable-xdebug (or: ../configure --enable-xdebug
--with-php-config=/path/to/php-config if php-config is not in your
path)
5. Run: make
6. cp modules/xdebug.so /to/wherever/you/want/it
7. add the following line to php.ini:
zend_extension="/wherever/you/put/it/xdebug.so"
8. Restart your webserver.
9. Write a PHP page that calls "phpinfo();" Load it in a browser and
look for the info on the xdebug module. If you see it, you have been
successful!
遇到的问题执行phpize 报错,解决办法: http://www.geekso.com/mac-phpize/
3、修改/etc/php.ini
zend_extension = "xdebug解压后的安装文件目录/modules/xdebug.so" #或者看上面的(6. cp modules/xdebug.so /to/wherever/you/want/it)
xdebug.remote_enable =1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000
注意:remote_host 是指调试客户端的地址,即IDE所在的IP,同理remote_port 是客户端的端口,这两项在远程调试的情况下注意修改
4、 php -m |grep Xdebug 有则成功5、配置phpStorm
1)进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息,name填localhost,host填localhost,port填80,debugger选XDebug
2)进入File>Settings>PHP>Debug,看到XDebug选项卡,port填9000,其他默认
3)进入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 PHPSTORM,host 填localhost,port 填80
4)在phpStorm里打开监听,就是一个电话一样的按钮。
6、在浏览器里打开XDebug工具,访问localhost,与phpStorm连接成功!