|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30894 Warning: ftp_put(): PORT command successful in...
Submitted: 2004-11-25 10:29 UTC Modified: 2005-01-17 08:09 UTC
Avg. Score:4.0 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:2 (40.0%)
From: evans at datahost dot gr Assigned:
Status: Not a bug Package: FTP related
PHP Version: 4.3.9 OS: Fedora Core 3 & (Kernel 2.6.9)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: evans at datahost dot gr
New email:
PHP Version: OS:


 [2004-11-25 10:29 UTC] evans at datahost dot gr
I have just installed Fedora Core 3 and compiled PHP 4.3.9

Everything works fine except my php scripts that user the ftp_put function.

On fedora core 1 there was no problem at all and i haven't changed anything to the scripts or the compilation of PHP.

The error that ftp_put returns is:
Warning: ftp_put(): PORT command successful in /home/www/www/test.php on line 16

PHP Connects successfuly to the FTP Server (Proftpd 1.2.9) it uploads the file but its size is 0 bytes.

The same problem was also in Fedora Core 2.
I Heard that FC2 has several problems with some libraries so i didn't searched further for it.

I Also tried to enable the passive mode (as i read in several forums) with no result.
Even the code as it is on the PHP Manual doesn't work.
I suppose it is not a problem of permissions as it uploads a file to the ftp server but as i said its size is 0 bytes.

Is there a possibility that PHP's ftp_functions doesn't work correct with kernels 2.6.x ?

My configure command follows :

'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--enable-track-vars' '--enable-ftp' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-sigchild' '--enable-sockets' '--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--enable-gd-imgstrtt' '--enable-gd-native-tt' '--enable-bcmath' '--enable-dio' '--enable-mcal' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-memory-limit' '--enable-trans-sid' '--enable-magic-quotes' '--enable-pic' '--enable-yp' '--enable-wddx' '--enable-dbx' '--enable-cli' '--enable-inline-optimization' '--enable-force-cgi-redirect' '--enable-ucd-snmp-hack' '--enable-filepro' '--enable-exif' '--enable-dbase' '--enable-dba' '--enable-zend-multibyte' '--enable-static' '--enable-shared' '--enable-fast-install' '--with-pdflib=/usr/local' '--with-mm=/usr/local' '--with-swf=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-freetype-dir=/usr/local' '--with-imap=/usr/local/imap-2004b' '--with-kerberos' '--with-mysql=/usr/local/mysql' '--with-zip=/usr/local' '--with-bz2=/usr/local' '--with-zlib=/usr/local' '--with-openssl=/usr/local/ssl' '--with-imap-ssl=/usr/local' '--with-gettext=/usr/local' '--with-curl=/usr/local' '--with-mhash=/usr/local' '--with-layout=GNU' '--with-gd' '--with-ttf' '--with-xml' '--with-gdbm' '--with-iconv' '--with-ncurses' '--with-hyperwave' '--with-gmp' '--with-tsrm-pthreads' '--with-db4' '--with-xml' '--with-pear' '--with-ldap' '--with-mime-magic' 

The php.ini doesn't have any weird modifications except that i enabled Register_Globals.

Thank you in advance,
Evans C. Koutroumpas.

Reproduce code:
$ftp_server = 'localhost';
$ftp_user_name = 'www';
$ftp_user_pass = 'papastratos';
$file = 'test.gif';
$remote_file = 'test2.gif';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
// close the connection

Expected result:
successfully uploaded test2.gif

Actual result:
Warning: ftp_put(): PORT command successful in /home/www/www/test.php on line 16
There was a problem while uploading test.gif 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-27 09:21 UTC]
Please try using this CVS snapshot:
For Windows:

Works fine here.
 [2004-11-27 20:39 UTC] evans at datahost dot gr
Still doesn't work.

I compiled the latest Snapshop (with the same configure command i quoted above) and i get the same warning.

Warning: ftp_put(): PORT command successful in /home/www/www/index.php on line 16

The file gets uploaded but its size is 0 bytes.

As long as I remember when I was trying Fedora Core 2 the problem was with a different/older version of PHP.
 [2005-01-07 19:03 UTC] linhaibo at hotmail dot com
wait 90s later,display:

Warning: ftp_put(): Opening BINARY mode data connection for 1105119149_new.rm. 

1105119149_new.rm is remote server file

uploads the file, but its size also is 0 byte.
 [2005-01-07 21:35 UTC] evans at datahost dot gr
After various tests I am almost sure that some library from Fedora Core (after the default install i do a yum update) affects PHP.

With the default installation of Fedora Core 1 I never had the problem described above.
Now I reinstalled Fedora Core 1 and I did a yum update and changed some libraries with new ones.
I also changed the kernel to 2.4.28 (manually compiled) and I get again the error with ftp_put().

p.s.: The problem exists in PHP 4.3.10
 [2005-01-13 14:46 UTC] lafriks at hello dot lv
I have the same warning and uploaded file is 0 bytes. I'm usnig Mandrake Cooker and have apache2-mod_php5-2.0.52_5.0.3-1mdk
 [2005-01-14 13:12 UTC] von_helmet at hotmail dot com
Same problem running PHP on a Gentoo system.

PHP 4.3.10
Apache 2.0.52
Kernel 2.6.10-gentoo-r4

I get the following error message when trying to upload a file:

"Warning: ftp_put(): PORT command successful in /home/peter/ftptest.php on line 22
Couldn't copy file."

When I check on the remote server, there is a file of 0 bytes with 644 perms.
 [2005-01-16 19:04 UTC] raducalauz at yahoo dot com
Hi all,
I have run into the same problem like you, using PHP 4.3.6 on my VMware machine.
But the funny part for me was because for some FTP servers was working and for some others not.
After some research, I found out the firewall was blocking the connection. Even if I tried to use passive FTP,
the server where i was trying to make FTP and was not working, was trying to connect back to me on port 20 (ftp-data port)
After i have accepted connection on this port, all was fine. 
Hope is helping you.
p.s. For the FTP which was working i have give permissions the to IP for all type of connections.
 [2005-01-16 20:26 UTC] raducalauz at yahoo dot com
Hi again,
I forgot to said about my system: 
Fedora Core 2
PHP 4.3.6
Kernel 2.6.6
Apache 2.0.51

Now i tested against some different FTP servers, so is also not related with the servers. All tests was working and all of them was not using passive FTP.

Radu Calauz
 [2005-01-16 23:58 UTC] evans at datahost dot gr
Today I realised that some other functions weren't working because of a buggie version of Zend Optimizer (ver. 2.5.5).

I replaced Zend Optimizer with version 2.5.7 and everything worked fine.

I couldn't test the ftp_put() function though because i downgraded to Fedora Core 1 were ftp_put() works fine no matter what is the version of Zend Optimizer.
 [2005-01-17 08:09 UTC]
Let's mark it as "not a PHP bug" then. Please reopen if you re-encounter the problem.
 [2015-07-21 07:14 UTC] iletisim at kursadaltan dot com
Merhaba, aynı hatayı şuan bende alıyorum.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 28 04:03:34 2022 UTC