I'm trying to add FTP together with SSL myself as suggested by #1488 but it doesn't work for me properly, and after couple of days of debugging I'm lost.
I'm getting SSL_read on shutdown: error:0A000126:SSL routines::unexpected eof while reading in /ftp_test.php
Normally I'm using https://github.com/dg/ftp-deployment, but to mitigate risk that issue lives in that library, I prepared simple script and getting same result.
In the script below I'm getting that error on line with ftp_close($conn). If I delete that line, I get same error on line with unset($conn)
$url = parse_url("ftps://host.net/path/to/test/folder");
// Connect
$conn = ftp_ssl_connect($url["host"], 21) or die("Could not connect to");
ftp_login($conn, "username", "pass") or die("fail to login");
ftp_set_option($conn, FTP_USEPASVADDRESS, false) or die("fail to set option");
ftp_pasv($conn, true) or die("fail to set passive mode");
ftp_chdir($conn, $url['path']) or die("fail to change directory");
// Upload file
$path = "test-".date("Y-m-d_H-i-s").".txt";
file_put_contents($path, "test");
ftp_put($conn, $path, $path, FTP_BINARY) or die("fail to upload");
sleep(5);
ftp_close($conn) or die("fail to close");
unset($conn);
echo "done";
My Alpine Dockerfile is
FROM php:8.3-alpine
RUN apk update \
&& apk add --no-cache openssl-dev make git bash lftp coreutils
RUN docker-php-ext-configure ftp --with-openssl-dir=/usr \
&& docker-php-ext-install ftp
but I also tried non-alpine PHP image but with same result
FROM php:8.3
RUN apt-get update \
&& apt-get install -y libssl-dev make git bash lftp coreutils
RUN docker-php-ext-configure ftp --with-openssl-dir=/usr \
&& docker-php-ext-install ftp
I'm trying to add FTP together with SSL myself as suggested by #1488 but it doesn't work for me properly, and after couple of days of debugging I'm lost.
I'm getting
SSL_read on shutdown: error:0A000126:SSL routines::unexpected eof while reading in /ftp_test.phpNormally I'm using https://github.com/dg/ftp-deployment, but to mitigate risk that issue lives in that library, I prepared simple script and getting same result.
In the script below I'm getting that error on line with
ftp_close($conn). If I delete that line, I get same error on line withunset($conn)My Alpine Dockerfile is
but I also tried non-alpine PHP image but with same result