我正在使用Netbeans 6.7和XDebug在我的机器上调试PHP站点,从Netbeans(Project-> Debug)中启动请求.这很好用,非常有用.
我的问题是:是否可以将调试器附加到任何进入的请求中,而不仅仅是我从Netbeans中启动的那些请求?
即,不是单击"调试",而是将Netbeans置于启动调试器并附加到下一个请求的模式中.
我有一种感觉,这可能是一个愚蠢的问题,但如果有可能,那就太好了.
编辑:更多信息
我的系统(Ubuntu 9.04)设置如下:
的内容 /etc/php5/conf.d/xdebug.ini
zend_extension=/usr/lib/php5/20060613/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
Run Code Online (Sandbox Code Playgroud)
Netbeans PHP调试选项是默认值:
Debugger Port: 9000
Session ID: netbeans-xdebug
Stop at the First Line: ticked
Run Code Online (Sandbox Code Playgroud)
我的/etc/hosts文件重定向www.mywebsite.com到localhost
如果我单击Netbeans中的调试按钮,则会使用该地址启动Firefox http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug,调试器将按预期工作.
但是,如果我只是浏览http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug,这不会启动Netbeans中的调试器.
我也试过设置xdebug.remote_host=www.mywebsite.com,但没有区别.
此外,我启用了xdebug.remote_log,这显示了我从netbeans开始时的信息,但没有外部请求的信息.所以我认为XDebug根本没有看到外部请求.
尝试使用Netbeans上的Xdebug(在Windows 8上)调试卷曲请求时,我遇到了一个奇怪的问题.这是我的代码:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
if ( curl_errno($ch) ) {
$result = 'ERROR -> ' . curl_errno($ch) . ': ' . curl_error($ch);
echo $result;
}
print "\n response = \n";
var_dump($response);
// close cURL resource, and free up system resources
curl_close($ch);
die;
Run Code Online (Sandbox Code Playgroud)
当我使用Netbeans进行调试时,我得到:
ERROR -> 28: Operation timed out after 10015 milliseconds with 0 out of -1 bytes receivedresponse = bool(false)
Run Code Online (Sandbox Code Playgroud)
当我在没有调试的情况下运行时,我没有得到错误和xampp页面的响应.
在php.ini我有:
[XDebug]
zend_extension …Run Code Online (Sandbox Code Playgroud)