Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ftp cunctions

Posted on 2009-06-28
4
Medium Priority
?
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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