1. 设置Php.ini
[Xdebug]
zend_extension="D:\xampp\php\ext\php_xdebug-2.1.2-5.3-vc6.dll"
xdebug.profiler_enable=on
xdebug.trace_output_dir="d:\xampp\tmp"
xdebug.profiler_output_dir="d:\xampp\tmp"
xdebug.auto_trace=Off
xdebug.collect_params=on
xdebug.collect_return=on
xdebug.show_exception_trace = On
xdebug.remote_autostart = Off
xdebug.remote_enable = On
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.collect_vars = On
xdebug.remote_port = 10000
具体下载哪个xdebugdll可以查看自己的phpinfo(),然后将内容提交到xdebug官网,然后xdebug官网会告诉你下载相应的的dll。
另外很多教程上说的用端口9000,但是该端口很可能被占用,所以建议改成10000端口。
2. 重启apache
3. 在zend studio中需要设置:
Xdebug端口10000(与步骤1保持一致)
PHP executable为php-cgi.exe, SAPI Type是CGI, PHP Debugger: XDebug
4. 新建下面的php文件进行调试
<?php
for ($i = 0; $i < 10; $i++) {
if ($i==5) {
echo 'aa';
}
}
?>