0

Error in nginx error log : fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol in <file> on line <no>

I am able to connect using FileZilla, WinSCP and also ftp_ssl_connect(). But I am not able to connect using fsockopen("ssl://domain.com", $port, $errno, $errstr, $timeout).

This command openssl s_client -connect domain.com:21 -starttls ftp gives me proper output, but if I remove the STARTTLS command it gives this error :

CONNECTED(00000003)
47404513277584:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:766:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 321 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

Can anyone help me how to put STARTTLS command in my PHP code ? Please let me know if you guys need any other details I will edit the post.

John Conde
  • 217,595
  • 99
  • 455
  • 496
Jigar
  • 3,256
  • 1
  • 30
  • 51

1 Answers1

0

Try to use 465 port. For better answer please provide some info (some php code or if you are using a dedicated php class like PhpMailer please specify it)

Repky
  • 596
  • 7
  • 8