|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68854 Cannot FTP_Put over SSL
Submitted: 2015-01-19 07:46 UTC Modified: 2021-03-14 04:22 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: ian dot gooch at weatherquest dot co dot uk Assigned: cmb (profile)
Status: No Feedback Package: FTP related
PHP Version: 5.5.20 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
41 - 33 = ?
Subscribe to this entry?

 [2015-01-19 07:46 UTC] ian dot gooch at weatherquest dot co dot uk
I've tried and tried to ftp_put over a secured connection. Errors returned are 

 ftp_put(): Opening BINARY mode data connection.
 Type set to I

I've tried to  things like ftp_pasv, but no joy.

I know the connection work because Dreamweaver connects are uploads fine.


Test script:
echo "$FTPServer | $Port | $User | $Pass <br>";
$FTPCon       = ftp_ssl_connect($FTPServer,$Port) or die("Cannot connect to server!");
$LOGINR       = ftp_login($FTPCon,$User,$Pass)    or die("Cannot login!");
ftp_set_option($FTPCon, FTP_TIMEOUT_SEC, 10);
if ((!$FTPCon) || (!$LOGINR)) {
echo "FTP connection has failed!";
echo "Connected to $FTPServer,$Port, for user $User <br/>";
echo "Current directory: " . ftp_pwd($FTPCon) . "\n";
echo "<br>";
if (ftp_chdir($FTPCon, "*******")) {
echo "Current directory is now: " . ftp_pwd($FTPCon) . "<br>";
echo "Couldn't change directory <br>";
echo "<br>";
$UPLoad = ftp_put($FTPCon,$NAME,$csvOut,FTP_BINARY);
if (!$UPLoad) {
echo "FTP upload of $NAME has failed! <br/>";
echo "Uploading $name Completed";
echo "Bye Bye you";

Expected result:
The file uploads (ftp) to a secured server


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-21 23:36 UTC] cmbecker69 at gmx dot de
Have you considered asking in a support forum or mailing list,
such as before filing a bug report?

Anyhow, the following statement looks suspicious:

  ftp_set_option($FTPCon, FTP_TIMEOUT_SEC, 10);
 [2015-01-22 07:32 UTC] ian dot gooch at weatherquest dot co dot uk
Yes. I've asked on Stack overflow, but with no joy.
When I have google'ed the problem, it would appear lots of programmers have had the same issue, with some resulting in using Curl instead.

I added the ftp_set_option($FTPCon, FTP_TIMEOUT_SEC, 10); as I got fed up waiting for the default 60 secs timeout.
 [2021-03-04 11:25 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-03-04 11:25 UTC]
I wonder whether that FTP server is even configured for FTPS, or
whether it expects SFTP connections, what is not supported by the
ftp extension (you could use the ssh2 extension instead).
 [2021-03-14 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Oct 04 09:01:25 2023 UTC