在PHP中调试libcurl本身(低级)

时间:2019-03-04 16:29:55

标签: php debugging libcurl

我有一个非常简单的代码段:

<?php
    $fp = fopen(dirname(__FILE__).'/errorlog.txt', 'w');
    fwrite($fp, "writing works..\n");
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://10.0.0.1/url");
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_STDERR, $fp);
    print_r(curl_exec($ch));
    print_r(curl_errno($ch));
    print_r(curl_getinfo($ch));
    print_r(curl_version());
    curl_close($ch);
    fclose($fp);
?>

总体上可以正常工作,但是当前在我使用的特定环境中已损坏。 curl_errno返回2,即CURLE_FAILED_INIT

我正在尝试调查是否存在系统问题here,但我想知道是否可以通过某种方式调试代码,这是什么问题。

类似于this问题中的答案不会产生任何输出(文件errorlog.txt很容易发现为空..我猜这是我想的,因为libcurl甚至无法初始化)。

curl_getinfo()的输出是无用的,因为它永远不会执行请求。这是curl_version的输出:

[version_number] => 466176
[age] => 3
[features] => 558781
[ssl_version_number] => 0
[version] => 7.29.0
[host] => x86_64-redhat-linux-gnu
[ssl_version] => NSS/3.28.4
[libz_version] => 1.2.7
[protocols] => Array
    (
        [0] => dict
        [1] => file
        [2] => ftp
        [3] => ftps
        [4] => gopher
        [5] => http
        [6] => https
        [7] => imap
        [8] => imaps
        [9] => ldap
        [10] => ldaps
        [11] => pop3
        [12] => pop3s
        [13] => rtsp
        [14] => scp
        [15] => sftp
        [16] => smtp
        [17] => smtps
        [18] => telnet
        [19] => tftp
    )

有人有指针吗?

谢谢

0 个答案:

没有答案