php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29110 ftp_rawlist problem 'php_connect_nonb() failed: Connection refused'
Submitted: 2004-07-12 17:56 UTC Modified: 2004-09-21 22:00 UTC
From: fcurra at tecnonexo dot com Assigned:
Status: Not a bug Package: FTP related
PHP Version: 4.3.7 OS: Linux 2.4.25
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fcurra at tecnonexo dot com
New email:
PHP Version: OS:

 

 [2004-07-12 17:56 UTC] fcurra at tecnonexo dot com
Description:
------------
I need to retrieve files from a SSL-FTP connection. 

I started working with PHP 4.3.3, but the function ftp_rawlist() allways returned false with a specific FTP server (casually the one which i need to connect, it works with others). So, after read comments about other ocurrences of this problem i installed PHP 4.3.7 and tried again. I though that maybe with the last PHP version this problem were solved.

When i execute the reproduced code, received the actual result showed.

Reproduce code:
---------------
if( $conn_id = ftp_ssl_connect($ftp_host) ) {
        $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

        ftp_pasv($conn_id, true);

        $pwd = ftp_pwd($conn_id);

        $buff = ftp_rawlist($conn_id, $pwd);
        var_dump($buff);
}

ftp_close($conn_id);


Expected result:
----------------
print the list of files.

Actual result:
--------------
Warning: ftp_rawlist(): php_connect_nonb() failed: Connection refused (111) in /usr/local/apache_1.3.27/htdocs/nti/connect.php on line 44

bool(false) 


** LINE 44 is ***********************
$buff = ftp_rawlist($conn_id, $pwd);
*************************************


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-12 18:27 UTC] fcurra at tecnonexo dot com
Comment about behavior. If you don't use passive mode (comment line ftp_pasv) then the warning doesn't appear. Any ideas?
 [2004-07-12 19:08 UTC] pollita@php.net
What is the return value of ftp_pasv()?

  var_dump(ftp_pasv($conn_id, true));
 [2004-07-12 19:16 UTC] pollita@php.net
Oh, and is there any IPv6 involved here?  (Take a look at phpinfo() to see if it says IPv6 enabled)  Does the remote server support IPv6?  Are you passing a hostname or an IP address?

If both ends are IPv6 capable, try connecting with an IPv4 address (1.2.3.4 as opposed to ftp.foo.com) to see if it behaves properly.  
 [2004-07-12 20:10 UTC] fcurra at tecnonexo dot com
result of var_dump(ftp_pasv($conn_id, true));
is bool(true)
 [2004-07-12 20:17 UTC] fcurra at tecnonexo dot com
I'm not sure if IPv6 is involved. I don't see any reference in phpinfo(), and PHP is not compiled with '--disable-ipv6'. By the way, i'm passing an IP address.

Thanks
 [2004-09-21 14:27 UTC] fcurra at tecnonexo dot com
I finally found the solution of my problem. It wasn't a PHP Bug, but a firewall miss configuration. I enabled 'accept connection' rule on high ports (1024 to 65535) for that server, and that worked out. 

More about in : http://shorewall.net/FTP.html
 [2004-09-21 22:00 UTC] pollita@php.net
Not Bug => Bogus
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 21 21:03:37 2022 UTC