安装xdebug
本文由百家号/熊掌号作者上传并发布,百家号仅提供信息发布平台。文章仅代表作者个人观点,不代表百度立场。
-
下载xdebug
可到 xdebug官网 下载与自己PHP版本对应的xdebug扩展 - 安装
[root] # cd /usr/local/src
[root] # tar zxvf xdebug-2.6.0RC2.tgz
[root] # cd xdebug-2.6.0RC2
[root] # /usr/local/php/bin/phpize
[root] # ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config
[root] # make && make install
- 配置xdebug
修改php.ini配置文件,在文件中追加以下内容zend_extension=xdebug.so //指定Xdebug扩展文件的路径 xdebug.remote_enable=1 //是否开启远程调试 xdebug.remote_handler=dbgp //指定远程调试的处理协议 xdebug.remote_mode=req //可以设为req或jit,req表示脚本一开始运行就连接远程客户端,jit表示脚本出错时才连接远程客户端。 xdebug.remote_host=192.168.1.98 //指定远程调试的主机名(安装phpstorm的主机ip) xdebug.remote_port=9001 //指定远程调试的端口号 xdebug.idekey="PHPSTORM" //指定传递给DBGp调试器处理程序的IDE Key
其他配置项见官网
配置phpstorm
- 弹出设置窗口(file->settings or ctrl+alt+S)
- 设置调试端口,需要与php.ini中的配置一致
- 配置调试主机
- 测试
原文地址:http://blog.51cto.com/13660331/2093885