php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33252 failed to open stream: FTP server reports 220
Submitted: 2005-06-06 01:52 UTC Modified: 2005-06-14 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: anil at saog dot net Assigned:
Status: No Feedback Package: FTP related
PHP Version: 4.3.10 OS: linux FC2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: anil at saog dot net
New email:
PHP Version: OS:

 

 [2005-06-06 01:52 UTC] anil at saog dot net
Description:
------------
using fopen function for ftp connections on default port (21) without declaring port in function, brings an strange error;

Reproduce code:
---------------
$handle = fopen("ftp://..@62.75.202.32/bug.txt", "r");
$oldContent = fread($handle,5000000);
fclose($handle1);



Expected result:
----------------
as you see port is default (21) and not declared in function, this code gives error;
"failed to open stream: FTP server reports 220"

as you know 220 means connection accepted, and it is not an error. But if you change the remote port (for example 2122) and/or declare it in function, there will be no problem;

$handle = fopen("ftp://..@62.75.202.32:2122/bug.txt", "r");

or if you can't change the remote port;

$handle = fopen("ftp://..@62.75.202.32:21/bug.txt", "r");



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-10-05 12:23 UTC] fcartegnie at nordnet dot fr
I got the same problem, on a server.(passive supported)

"failed to open stream: FTP server reports 220 Serv-U FTP Server v6.0 for WinSock ready..."

At this point, 'result' variable worth '220'

ftp_fopen_wrapper.c
changing line 181
	if (result > 299 || result < 200) {
to
	if ((result > 299) || (result < 200)) {

changes the error in
"failed to open stream: Address family not supported by protocol"
 [2006-10-30 02:40 UTC] l33_adrian at yahoo dot com
i experience the same error "failed to open stream: Address family not supported by protocol" im trying to open a url file thru http:// (sorry if i psted this on a wrong section)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Mar 27 23:01:31 2025 UTC