You are here: ftp_nlist "425 Can't open data connectoin" « All PHP « IT news, forums, messages
ftp_nlist "425 Can't open data connectoin"

Posted by blackpuppy on 08/19/06 18:33

I am just beginner on PHP. I am reading "Spring Into PHP 5" but cannot
make the ftp examples work.

I am running PHP scripts on a Fedora Core 5 (VMWare virtual machine) on
top of a Windows XP Professional. The PHP version is 5.1.4. The PHP
script is shown below.

#! /usr/bin/php
<?php
$ftp_server = "myftpserver";
$connect = ftp_connect($ftp_server)
or die("Couldn't connect to $ftp_server.");
$result = ftp_login($connect, "myftpuser", "mypassword")
or die("Couldn't log in $ftp_server.");
$a = ftp_nlist($connect, "/");
foreach($a as $value){
echo $value, "\n";
}
?>

I run the above script in a GENOME terminal. It seems it can connect
and log in to the ftp server successfully. But then the ftp_nlist()
call fails. And the server has the following log for this call.

> NLST /
> 150 Opening data channel for directory list.
> 425 Can't open data connection.

I do not know what is wrong. But in a terminal I can manually log in
the ftp server, and the ls or nlist command will give the file list as
expected. So I suspect the problem is at the PHP ftp function.

The PHP manual on FTP functions
(http://www.php.net/manual/en/ref.ftp.php) has the following
explanation.

"No external libraries are needed to build this extension.

In order to use FTP functions with your PHP configuration, you should
add the --enable-ftp option when installing PHP 4 or greater or
--with-ftp when using PHP 3.

This extension has no configuration directives defined in php.ini."

My questions are:
- How could I know what is wrong with the ftp_nlist() call?
- How could I know if the FTP functions are enabled at PHP
installation?
- How to make the FTP functions work?

Thanks a lot!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация