在php.ini尾部添加如下
[xdebug]
zend_extension="php_xdebug.dll"
xdebug.remote_enable = On
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"
xdebug.auto_trace = 1
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.collect_return = 1
xdebug.default_enable = 1
xdebug.collect_assignments = 1
xdebug.collect_vars = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.show_local_vars = 1
xdebug.show_exception_trace = 0
运行phpinfo();看有xdebug模块信息出来就是搞定了.
这里的配置很重要
选择Zend Studio 的 Window >> Preference >> PHP >>Installed Debuggers 双击 Xdebug,弹出对话框如下图
Accept remote session(JIT) 选择localhost
允许浏览器访问网站时zend studio自动打开文件开始调试.
选项说明:
off: 关闭浏览器访问时打开调试功能;
localhost: 通过localhost访问网页的时候打开调试.
any:只要访问服务器上的php都打开调试;
prompt:访问服务器上的php时弹出询问是否要调试.
一旦打开zend studio允许xebug调试,所有访问php页面都会进入调试.
①.、首先php.ini设置
xdebug.remote_autostart = 0
不自动启动调试.
另外,可设置使用xdebug,在zend studio中对直接调试php文档,这里就不多说了.
在[XDebug]下添加
zend_extension="D:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_mode=req
在项目下添加一个文件file.php,里面的内容是
php
/*
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
print("XDebug Test"); // 今天这一节添加一个XDebug Breakpoint
Ide Identification String = testID
在Pathmap下新建一个内容
运行xampp,启动apache,在浏览器输入,即进入调试
在eclipse切换到Debug视图即可看到程序已运行到断点处
选择【PHP(php.ini)】选项
XAMPP捆绑了相应的 Xdebug .dll 文件,只需将php.ini中默认注释掉的地方释放即可使用该文件(对应的目录修改成XAMPP相应的目录).
保存 php.ini.重启XAMPP,启动Apache、MySQL,访问phpinfo.php能看到xdebug的界面.
在要调试的项目上右键选择【Debug As】 >> 【Debug Configurations】,设置Main标签下的参数
设置Pathmap标签下的参数(路径为项目工程的存放路径).
以上就是土嘎嘎小编为大家整理的php调试利器xdebug相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!