0

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.

Daisy
  • 9
  • 1
  • 1
    What is "SSL v6"? Your code specifies `CURL_SSLVERSION_TLSv1_2`, have you tried an older version? Perhaps your server doesn't support TLS v1.2. – miken32 May 28 '19 at 17:14
  • 1
    The reference to SSL 3 in the error message is irrelevant; it's just the name of the function involved, and has that name for legacy reasons. – miken32 May 28 '19 at 17:14

0 Answers0