Solved

ftp cunctions

Posted on 2009-06-28
4
260 Views
Last Modified: 2015-01-05
I use wampserver program to make localhost and I try this code
<?php
$conn = ftp_connect('192.168.4.2',21,3) or die("Could not connect");
?>
but the connection failed
why ??????
0
Comment
Question by:mega-scorpion
  • 2
4 Comments
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 24731658
Are you running a ftp server on 192.168.4.2? 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.
0
 
LVL 14

Accepted Solution

by:
profya earned 500 total points
ID: 24731960
If you are targeting your localhost (192.168.4.2) 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.
0
 
LVL 11

Expert Comment

by:BrianMM
ID: 24734551
also check your firewall...

if the address exists unless firewall either your end or their end is blocking it what you have should work.
0
 
LVL 14

Expert Comment

by:profya
ID: 24734795
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:
ftp_connect('192.168.4.2',21,120)
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question