douhuiqi3855 2019-05-28 15:28
浏览 139

PHP cURL无法通过FTP隐式上传文件

I'm using cURL in PHP to FTP a file to a server implicitly and I'm getting the following error:

"Could not upload file. cURL Error: [35] - error:1408F10B:SSL routines:ssl3_get_record:wrong version number"

In my code I'm specifying SSL v6 but it still seems to be trying to use SSL v3. These are the options I'm setting in curl_setopt.

$options = array(
        CURLOPT_USERPWD        => $username . ':' . $password,
        CURLOPT_SSL_VERIFYPEER => false, // don't verify SSL
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_FTP_SSL        => CURLFTPSSL_ALL, // require SSL For both control and data connections
        CURLOPT_FTPSSLAUTH     => CURLFTPAUTH_DEFAULT, // let cURL choose the FTP authentication method (either SSL or TLS)
        CURLOPT_UPLOAD         => true,
        CURLOPT_PORT           => $port,
        CURLOPT_TIMEOUT        => 30,
        CURLOPT_SSLVERSION     => CURL_SSLVERSION_TLSv1_2, //https://stackoverflow.com/questions/30145089/tls-1-2-not-working-in-curl
    );

This is the output when I run curl --version on my machine.

curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1b zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24

I'm sure that the FTP credentials are correct as they work in FileZilla.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器