Solved

ftp cunctions

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
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 …

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now