您的位置:首页 > 编程语言 > PHP开发

PHPSTORM 6.0.3 Xdebug 配置9

2013-01-02 12:45 330 查看
php.ini配置文件

作者:風
[XDebug]
zend_extension = "e:\xampp\php\ext\php_xdebug.dll"

;显示错误的跟踪信息
xdebug.default_enable=1
;开启自动跟踪
xdebug.auto_trace = 1
;开启异常跟踪
xdebug.show_exception_trace = 1

;收集变量
xdebug.collect_vars = 1
;收集返回值
xdebug.collect_return = 1
;收集参数
xdebug.collect_params = 1

;打开xdebug的性能分析器,以文件形式存储
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "e:\xampp\tmp"
;性能分析文件的命名规则
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
;函数调用跟踪信息输出文件目录
xdebug.trace_output_dir = "e:\xampp\tmp"

;开启远程调试自动启动
xdebug.remote_autostart = 1
;开启远程调试
xdebug.remote_enable = 1
;应用层通信协议
xdebug.remote_handler = "dbgp"
;选择debug客户端正在运行的主机,你不仅可以使用主机名还可以使用IP地址
xdebug.remote_host = "localhost"
;这个端口是xdebug试着去连接远程主机的,如果端口冲突,可以更换其他端口
xdebug.remote_port=9000

通过代码设定 xdebug.auto_trace = 0,

并分别使用 xdebug_start_trace() 和 xdebug_stop_trace() 函数启用和禁用跟踪

1.调试好后,为什么不显示错误?

php.ini文件,找到并改

display_errors = on

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING

或者

在PHP文件中设置

ini_set("display_errors","On"); 

error_reporting(E_ALL);

2.PHPSTORM 6.0.3 配置

在php.ini [Xdebug]中增加


xdebug.idekey="PHPSTORM"

2.1.file->setings->php->Debug

右侧 Xdebug Debug port:9000    端口最好换个例如:9033 (9000与某些开发环境套件端口有冲突)

在左侧选中DBGp Proxy,右侧输入

IDE Key:PHPSTORM

Host:localhost

Port:9000

2.2 file->setings->php->servers

Name:服务器名称(如127.0.0.1)

host: 你的web服务器的域名或ip(如127.0.0.1),

端口:80如果没有设置的话就是默认

Debugger:选择 Xdebug

点击 ok

2.3 Run->Edit Configurations-> 增加一个 PHP WEB APPlication

Name:名称

Server:选择刚建立好的服务器127.0.0.1

Start Url:index.php(要调试的文件入口)

点击Ok

2.4 apache 或者nginx 要重启

2.5 调试

方法一

在index.php 中设置断点,点击 菜单栏 那个小虫子调试,如图



方法二:

2.5.2.1在index.php 中设置断点,

2.5.2.2菜单Run->Start Listen PHP Debug Connections    或点击 小虫子右侧 电话筒 图标

2.5.2.3访问地址http://127.0.0.1/index.php 链接成功

2.6 xdebug 与PHP 某些文件冲突,导致程序多次加载,程序执行错误

我使用过程出现的问题:调试 yii 2 框架时出现次问题,报 502 错误

解决问题方法:

把 xdebug.auto_trace=0    ,重启apache/nginx ,然后用调试方法1,即可正常

2.7 其他方法

http://www.chenxuanyi.cn/xampp-phpstorm-xdebug.html
http://www.cnblogs.com/kisay/p/373cdf43811f94f304cd376b9f6f9cb2.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Xdebug phpstorm php