|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2010-07-21 22:12 UTC] john-ubuntu at cornerstonelinux dot co dot uk
  [2010-07-21 22:43 UTC] mgdm@php.net
  [2010-07-21 22:43 UTC] mgdm@php.net
 
-Status: Open
+Status: Feedback
  [2010-07-21 22:53 UTC] john-ubuntu at cornerstonelinux dot co dot uk
  [2010-07-22 14:36 UTC] john-ubuntu at cornerstonelinux dot co dot uk
 
-Status: Feedback
+Status: Open
  [2010-07-22 14:36 UTC] john-ubuntu at cornerstonelinux dot co dot uk
  [2010-09-23 00:13 UTC] emperorshishire at gmail dot com
  [2021-02-19 16:06 UTC] cmb@php.net
 
-Status:      Open
+Status:      Feedback
-Assigned To:
+Assigned To: cmb
  [2021-02-19 16:06 UTC] cmb@php.net
  [2021-02-28 04:22 UTC] php-bugs at lists dot php dot net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Thu Oct 30 22:00:01 2025 UTC | 
Description: ------------ If "localhost" is present in /etc/hosts but does not resolve via DNS then ftp_c\ onnect will not connect to it. Most well setup DNS systems will have a "localhost." zone that resolves to 127.\ 0.0.1, but this is not compulsory and some ISPs do not do this. It is traditional for UNIX systems to be able to use local names as defined in \ /etc/hosts for basic names resolution before DNS. This bug does not appear to occur in other PHP network functions such as IMAP o\ r SMTP, and did not appear in PHP 5.2.4 on Ubuntu 8.04 (and earlier). I first noticed this bug when I upgrade a mail server from Ubuntu 8.04 to Ubunt\ u 10.04 and the Squirrelmail autorespond plugin (which uses ftp_connect) report\ ed a "failed to connect" error. To replicate this problem you will have to test on a system that does not resol\ ve "localhost" via DNS. Use the "host" command to check you can not do this: -------- $ host -v localhost Trying "localhost.uk.fabit.net" Trying "localhost" Host localhost not found: 3(NXDOMAIN) -------- Test script: --------------- <?php $ftp = ftp_connect($ftphost); if (!$ftp) { print "FTP connection failed"; } ?> Expected result: ---------------- An ftp connection with no error message. Actual result: -------------- No ftp connection attempt and my error message "FTP connection failed".