Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot upload file with ftps on PHP7 #85

Open
janedbal opened this issue May 24, 2016 · 12 comments
Open

Cannot upload file with ftps on PHP7 #85

janedbal opened this issue May 24, 2016 · 12 comments

Comments

@janedbal
Copy link

janedbal commented May 24, 2016

After update to PHP7 on Windows I tried to use ftps instead of ftp protocol since openssl is bundled in php, but deployment with ftps protocol doesn't work as expected.

If I run deployment via ftp, it works normally:

Loaded remote .htdeployment file
Scanning files in ...
Ignoring ....
Creating remote file .htdeployment.running

Uploading:
...

But if I run it with ftps i get strange error Error: Ok to send data. Also, the log falsely says that remote .htdeployment does not exist. File .htdeployment.running is created.

Remote .htdeployment file not found
Scanning files in ...
Ignoring ...
Creating remote file .htdeployment.running 
Error: Cannot upload file C:\Users\...\AppData\Local\Temp\deployment\dep189C.tmp, number of retries exceeded. Error: Ok to send data.

PHP 7.0.8, ftp-deployment 2.5, Wedos hosting

@janedbal
Copy link
Author

@dg Any hints what should I try to help resolve this issue?

@dg
Copy link
Owner

dg commented Jul 12, 2016

It seems that ftp in PHP doesn't work with Wedos. I am unable to list files via

$f = ftp_ssl_connect('12345.w71.wedos.net');
ftp_login($f, 'user', 'password');
var_dump(ftp_nlist($f, '*'));  

ftp_connect works fine.

@janedbal
Copy link
Author

Actually, this is more PHP problem than Wedos problem. After contacting their support I found that they require SSL session reuse, which is not implemented in PHP. Similar problem reported as PHP bug 70195


How to reproduce:

set_error_handler(function ($severity, $message) {
    echo $message;
});

$f = ftp_ssl_connect('12345.w91.wedos.net');
ftp_login($f, 'user', 'pass');
ftp_pasv($f, TRUE);
ftp_fput($f, 'file', fopen(__DIR__ . '/file', 'r'), FTP_BINARY);
ftp_fput(): SSL connection failed; session reuse required: see require_ssl_reuse option in vsftpd.conf man page`

@janedbal
Copy link
Author

janedbal commented Jul 26, 2016

@dg So if you don't want to use alternative ftp client implementation, we can close this issue...


edit: Or maybe there might be some better error when this occurs.

@dg
Copy link
Owner

dg commented Jul 27, 2016

Do you know alternative client?

ad better error: it is good idea, can you send PR?

@janedbal
Copy link
Author

The only one client which uses sockets I found is ngyuki/php-ftp-client, but it doesn't support ftps.

I'll try to find some time to send PR.

@OndraM
Copy link

OndraM commented Sep 8, 2016

FYI, SSL session reuse will be added to PHP 7.1 and 5.6.26.

@dg
Copy link
Owner

dg commented Sep 8, 2016

Great, so closing.

@dg dg closed this as completed Sep 8, 2016
@matak
Copy link

matak commented May 11, 2017

$ php -v
PHP 7.1.1 (cli) (built: Jan 18 2017 18:50:48) ( NTS MSVC14 (Visual C++ 2015) x86 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with blackfire v1.16.2~win-x32-non_zts71, https://blackfire.io, by Blackfireio Inc.

i have still same problem with this settings :(

@dg
Copy link
Owner

dg commented Mar 7, 2018

Still same problem with PHP 7.2.3

@dg dg reopened this Apr 24, 2018
@krystofklima
Copy link

Hi all,

Have You someone solved this ??? I have same problém and in version 7.1.17

@TheTEXcz
Copy link

TheTEXcz commented Jun 3, 2021

Hi all,

check if your temp folder exist. My was deleted and ftp_nlist returns bool(false).. I created it again and now it is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants