dan*_*pop 1 php curl 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 = "C:\xampp\php\ext\php_xdebug-2.2.5-5.4-vc9.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_autostart = 1
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = "9000"
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.max_nesting_level = 200
xdebug.idekey = "netbeans-xdebug"
Run Code Online (Sandbox Code Playgroud)
我想当你设置时xdebug.remote_autostart = 1,Xdebug将始终尝试启动远程调试会话并尝试连接到客户端(即使GET/POST/COOKIE变量不存在).
可能是,在你的情况下,Xdebug尝试连接Netbeans但无法完成操作,这导致Xdebug Operation timeout出错.