Php 在NetBeans上使用XDebug进行Curl
在Netbeans(windows8)上尝试用Xdebug调试curl请求时,我遇到了一个奇怪的问题。 这是我的密码:Php 在NetBeans上使用XDebug进行Curl,php,curl,netbeans,xdebug,Php,Curl,Netbeans,Xdebug,在Netbeans(windows8)上尝试用Xdebug调试curl请求时,我遇到了一个奇怪的问题。 这是我的密码: $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 = 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;
使用Netbeans进行调试时,我得到:
ERROR -> 28: Operation timed out after 10015 milliseconds with 0 out of -1 bytes receivedresponse = bool(false)
当我只是在没有调试的情况下运行时,我不会得到错误和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"
我假设当您设置
xdebug.remote\u autostart=1
时,xdebug将始终尝试启动远程调试会话并尝试连接到客户端(即使GET/POST/COOKIE变量不存在)
在您的情况下,可能是Xdebug尝试连接Netbeans,但无法完成操作,这会导致Xdebug出现
操作超时
错误。我想当您设置Xdebug.remote\u autostart=1
时,Xdebug将始终尝试启动远程调试会话并尝试连接到客户端(即使GET/POST/COOKIE变量不存在)
在您的情况下,Xdebug可能尝试连接Netbeans,但无法完成操作,这导致Xdebug出现
操作超时错误。我想您有道理。我将php.ini修改为这一点,它似乎可以工作[Xdebug]zend_extension=“C:\xampp\php\ext\php_Xdebug-2.2.5-5.4-vc9.dll”;xdebug.profiler\u append=0;xdebug.profiler\u enable=1;xdebug.profiler\u enable\u trigger=0;xdebug.profiler\u output\u dir=“C:\xampp\tmp;xdebug.profiler\u output\u name=“cachegrind.out.%t-%s”xdebug.remote\u enable=1 xdebug.remote\u handler=“dbgp”;xdebug.remote\u autostart=1 xdebug.remote\u host=“127.0.0.1”xdebug.remote\u port=“9000”;xdebug.trace_output_dir=“C:\xampp\tmp”xdebug.max_nesting_level=200 xdebug.idekey=“netbeans xdebug”@danpop就我在你的评论xdebug.remote\u autostart
中看到的,它仍然被设置为1
。可能是一个打字错误?它前面有一个分号,所以被注释掉了。干净的配置是:zend\u extension=“C:\xampp\php\ext\php\xdebug-2.2.5-5.4-vc9.dll”xdebug.remote\u handler=“dbgp”xdebug.remote\u host=“127.0.0.1”xdebug.remote\u port=“9000”xdebug.max\u嵌套级别=200 xdebug.idekey=“netbeans xdebug"这项工作非常感谢。断点在卷曲请求中不会停止,但是如果文件中有断点,卷曲正在击中,它就不会到达那里。@ NaseRuddvn,XDebug将不知道如何遵循卷曲请求。如果卷曲正在击中外部API,如果XDebug获得源,更不用说在它的某个地方断开?调试的出发点。我想你有一个观点。我将php.ini修改为这个,它似乎可以工作[XDebug]zend_extension=“C:\xampp\php\ext\php\XDebug-2.2.5-5.4-vc9.dll”;XDebug.profiler\u append=0;XDebug.profiler\u enable=1;XDebug.profiler\u enable\u trigger=0;XDebug.profiler\u output\u dir=“C:\xampp\tmp”;xdebug.profiler\u output\u name=“cachegrind.out.%t-%s”xdebug.remote\u enable=1 xdebug.remote\u handler=“dbgp”;xdebug.remote\u autostart=1 xdebug.remote\u host=“127.0.0.1”xdebug.remote\u port=“9000”;xdebug.trace\u output\u dir=“C:\xampp\tmp”xdebug.max\u nesting\u level=200 xdebug.idekey=“netbeans xdebug”@danpop就我在你的评论中看到的xdebug.remote\u autostart
仍然设置为1
。可能是打字错误?它前面有一个分号,所以被注释掉了。干净的配置是:zend\u extension=“C:\xampp\php\ext\php\xdebug-2.2.5-5.4-vc9.dll”xdebug.remote\u handler=“dbgp”xdebug.remote\u host=“127.0.0.1”xdebug.remote_port=“9000”xdebug.max_nesting_level=200 xdebug.idekey=“netbeans xdebug”这项工作非常感谢。断点在卷曲请求中不会停止,但是如果文件中有断点,卷曲正在击中,它就不会到达那里。@ NaseRuddvn,XDebug将不知道如何遵循卷曲请求。如果卷曲正在击中外部API,如果XDebug获得源,更不用说在它的某个地方断开?调试的出发点。