paip.php的调试--attilax总结php
php的调试可用PDT与XDEBUGGER,或者与zend debugger来。。若是是php WEB项目,只能web
进行远程调试,XDEBUGGER/zend debugge 加载起来后,把PHP的信息截获,而后链接PDT的浏览器
9000/10000端口,把内部信息发往ECLIPSE PDT了。。session
---------1.使用xdebugger------------
a.在PHP。INI配置xdebugger,而后PHPINFO()测试,肯定能够看到XDEBUGGER的配置。eclipse
。将其REMOTE配置所有打开..ide
b.设定multisession,这点很重要::: 在eclipse中的PDT插件,window>设定》PHP》DEBUG, 测试
打开PHP DEBUG设置页, php debugger选择XDEBUG,而后configure》installed url
debuggers>xdebugger>configure >xdebug/dbgp setting , 必定要选定“use 插件
multisession" ,这点很重要。默认端口9000通常不要改..debug
c.配置项目调试起动页:::而后在ECLIPSE图标栏,点DEBUG图标,open debug dialog> php
web page>配置为XDEBUG调试。。
d.进行调试。。在WEB开发中,只能进行远程调试。。本地调试仅仅对本地化PHP脚本而言。。
PDT不支持,直接在浏览器里输入URL,而后打断点,这样子是没法中止下来的,没法断点调试。。
这点和JAVA的远程调试不一样..
e.只能用PDT打开调试IE窗口,能够看到MS http://localhost/t2.php?
XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=13418867522671 ,有
XDEBUG_SESSION_START参数等...而后你再设置断点,再打入或者跳转到要测试的URL...
f.注意:::multisession设置很是重要,不然,你只能命中断点一次,就中止调试了。。设置了
multisession后,每次打开调试的PHP页面,,都会命中断点的.就和JAVA的远程调试差很少了...
---------------2.配置zend debugger进行远程调试----------
a.配置::
a.1. Add the following line to your php.ini file:
Linux and Mac OS X: zend_extension=<full_path_to_ZendDebugger.so>
Windows: zend_extension_ts=<full_path_to_ZendDebugger.dll>
Windows non-thread safe: zend_extension=<full_path_to_ZendDebugger.dll>
a.2. Add the following lines to your php.ini file:
zend_debugger.allow_hosts=<host_ip_addresses>
zend_debugger.expose_remotely=always
(*) hopst_ip_addresses are the IPs of the hosts which will be allowed to initiate
debug sessions
a.3. Copy the dummy.php file to your document root directory.
a.4. Restart your Web server.
b.在eclipse中的PDT插件,设置为zend debugger。
c.c.配置项目调试起动页::
d.d.进行调试。。也是须要要PDT打开调试窗口,不能直接窗口调试..URL ms:
http://localhost/t2.php?
debug_session_id=1000&start_debug=1&debug_start_session=1&debug_host=192.1
68.1.188%2C127.0.0.1&debug_no_cache=1341887571398&debug_port=10000&send
_sess_end=1&original_url=http://localhost/t2.php&debug_stop=1它会把PDT使用的链接端口发往zend debugger...