Solved

ftp cunctions

Posted on 2009-06-28
4
268 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

713 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