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

时间:2019-05-28 15:28:33

标签: php ssl curl ftp

我在PHP中使用cURL将文件隐式传输到服务器,但是出现以下错误:

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

在我的代码中,我指定了SSL v6,但它似乎仍在尝试使用SSL v3。这些是我在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
    );

这是我在计算机上运行curl --version时的输出。

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

我确定FTP凭据在FileZilla中正常工作时是正确的。

0 个答案:

没有答案
相关问题