I'm trying to connect to SSL enabled FTP servers. I've started with ftp_ssl_connect, wich had a good result. The connection was established and I can do everything I want using the available ftp commands. But it's pretty limited, and I require more controll over the connection (more asynchronous calls than just the get/put the normal provide) so I'm looking at the stream functions.
There are several ways to do ssl encrypted connections using the stream_socket_client functions (using ssl as a transport, turning encryption on after the connection is created with stream_socket_enable_socket, etc). But all result in the same error:
PHP Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:func(119):reason(252) in /home/hurri/php/test on line 16
I thought it might had to do with the self signed certificate the server has, so I created a context saying:
$ctx = stream_context_create( );
stream_context_set_option( $ctx, 'ssl', 'verify_peer', FALSE );
stream_context_set_option( $ctx, 'ssl', 'allow_self_signed', TRUE );
But that didn't change the error from popping up. I tried also with fsockopen(), but also: the same error.
I tested this using several ssl enabled ftp servers and all give me the same result. The most strange thing in this is that ftp_ssl_connect no problem has connecting.
Does anyone have a clue what might goes wrong here?