diff -Naur php-5.3.29_orig/ext/ftp/ftp.c php-5.3.29/ext/ftp/ftp.c
--- php-5.3.29_orig/ext/ftp/ftp.c	2014-08-14 01:22:50.000000000 +0600
+++ php-5.3.29/ext/ftp/ftp.c	2023-10-12 14:19:16.796511495 +0600
@@ -243,6 +243,7 @@
 {
 #if HAVE_OPENSSL_EXT
 	SSL_CTX	*ctx = NULL;
+	long ssl_ctx_options = SSL_OP_ALL;
 #endif
 	if (ftp == NULL) {
 		return 0;
@@ -279,7 +280,10 @@
 			return 0;
 		}
 
-		SSL_CTX_set_options(ctx, SSL_OP_ALL);
+#if OPENSSL_VERSION_NUMBER >= 0x0090605fL
+		ssl_ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
+#endif
+		SSL_CTX_set_options(ctx, ssl_ctx_options);
 
 		ftp->ssl_handle = SSL_new(ctx);
 		if (ftp->ssl_handle == NULL) {
@@ -1495,6 +1499,7 @@
 
 #if HAVE_OPENSSL_EXT
 	SSL_CTX		*ctx;
+	long ssl_ctx_options = SSL_OP_ALL;
 #endif
 
 	if (data->fd != -1) {
@@ -1521,7 +1526,11 @@
 			return 0;
 		}
 
-		SSL_CTX_set_options(ctx, SSL_OP_ALL);
+#if OPENSSL_VERSION_NUMBER >= 0x0090605fL
+		ssl_ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
+#endif
+		SSL_CTX_set_options(ctx, ssl_ctx_options);
+
 
 		data->ssl_handle = SSL_new(ctx);
 		if (data->ssl_handle == NULL) {