|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15383 ftp_connect() unable to connect to Internet IPs
Submitted: 2002-02-05 05:32 UTC Modified: 2002-08-11 01:00 UTC
Avg. Score:4.7 ± 0.6
Reproduced:10 of 10 (100.0%)
Same Version:6 (60.0%)
Same OS:4 (40.0%)
From: nickmc at codemasters dot com Assigned:
Status: No Feedback Package: FTP related
PHP Version: 4.1.1 OS: Windows 2000 Professional
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-02-05 05:32 UTC] nickmc at codemasters dot com
I have a script which automatically transfers files to another single machine via FTP accross the Internet. The script was working fine on our old test server which was Win98 running Omnihttpd and PHP 4.0.6. However on the new server running Win2k Pro, IIS, and PHP 4.1.1 it causes problems. Connection fails and trying to use the connection results in a "Unable to find ftpbuf 0" error.

I have written a simple test script and have come to the following conclusions:

* ftp_connect() to localhost is fine
* ftp_connect() to local network IPs is fine
* ftp_connect() to Internet IPs doesn't work

Using FTP from the command line on the same 2k box to the same address works all of the time regardless of the destination IP.

	$conn_id = ftp_connect($ip);
	print $ip."<br><br>";
	if($conn_id) {
		print "Connected OK";
	else {
		print "Unable to connect";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-05 07:19 UTC]
This seems like a configuration problem, but not with PHP (but I may be wrong).

Can you connect and work (!) with the command line ftp version of 'ftp' in your command line prompt?
 [2002-02-05 11:51 UTC] nickmc at codemasters dot com
Yes, every site that I've tried to connect to through command line FTP has been fine.
 [2002-02-06 12:54 UTC] pampi at ifrance dot com

I'm just having the same problem actually and it seems that the cause of this one is our network.

The ftp_connect can't establish a connection with the host because our LAN is on private IP, the router block the connection (or proxy or firewall).

Try to do it with a direct connection to Internet and it will work great like me...

But like you I would like it to work on my LAN ;)

To be continued give me news

 [2002-02-12 07:22 UTC] nickmc at codemasters dot com
No, that's the not the same. FTP connections to internal network IPs and localhost work fine. I cannot connect to Internet IPs.


This always returns no connection, regardless of the (external)FTP site that I attempt to connect to. FTP through either DOS FTP or Explorer works without problems to any FTP site, regardless of its location. I can't work this out as PHP should connect in exactly the same way as any other app, unless of course there's some rediculously small timeout period and it's giving up before it connects.
 [2002-05-02 04:57 UTC] dimitrij_holovka at yahoo dot com
I have a FTP server on IIS (Win NT) on LAN. I use ftp script from PHP help file (with changes to my server name).
If I connect via this script from Apache server to FTP server the connection is OK. If I use the same script from IIS (to the same FTP server) the connection returns "Unable to find ftpbuf 0". I think that problem is in IIS web server.
 [2002-07-10 23:20 UTC]
Please try the latest CVS snapshot from here:

Just make sure the date of this package is above 10-Jul-2002 19:25 

 [2002-08-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, 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".
 [2002-12-09 16:24 UTC] anonymous at hotmail dot com

I experienced the same problem (though I tried only 
Internet addresses, not the local one) - ftp over dialup 
didn't work. Solution: I restarted Apache 
(/etc/init.d/apache restart). Worked like magic. Looks 
like PHP module caches network info somewhere. Using PHP 
4.1.12 on Debian Linux (last stable release of PHP on 
Debian). But it is the same with Midnight Commander and 
KMail so it could be problem with my configuration. 
Konqueror on the other side doesn't have this problem.

Hope it helps.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 21 13:01:28 2024 UTC