ftp cunctions

I use wampserver program to make localhost and I try this code
$conn = ftp_connect('',21,3) or die("Could not connect");
but the connection failed
why ??????
Who is Participating?
profyaConnect With a Mentor Commented:
If you are targeting your localhost ( then it is expected to fail if you are only rely on wampserver, since the wampserver does not come with an FTP service. For this to work for you you need to install and configure an ftp server or using IIS FTP if you prefer, it is easy to run and administer.
Please refer to this http://www.wampserver.com/phorum/read.php?2,38316 for more information.
Roger BaklundCommented:
Are you running a ftp server on Port 21? Is the firewall open for this port? Have you tried increasing the timeout?

Try connecting with a "normal" ftp client to eliminate some sources for errors.
also check your firewall...

if the address exists unless firewall either your end or their end is blocking it what you have should work.
May be you need to increase the timeout, 3 is not enough as I think. You can use the default 90 seconds or more, depending on the traffic on the network:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.