ID: 8874
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Feedback
Bug Type: FTP related
Operating System: Windows 2000 Advanced Server
PHP Version: 4.0.4
New Comment:
This bug report was for PHP 4.0.4. There have been a few
changes since that in PHP 4.0.6. Have you tried with it?
And also, these functions do work on most ftp servers. What was the version of the ftp
server on which this didn't work?
--Jani
Previous Comments:
------------------------------------------------------------------------
[2001-08-14 21:07:00] [EMAIL PROTECTED]
$aFiles = Array( "Oct100.log.gz", "Nov100.log.gz");
// $aFiles = ftp_rawlist (nFTP, "/mnt/web/guide/accumeddata/logs/*.gz");
$aFiles = ftp_nlist ( $nFTP, "*.gz");
echo "count(aFiles)=" . count ($aFiles ) . "<BR>";
------------------------------------------------------------------------
[2001-08-14 20:10:30] [EMAIL PROTECTED]
can you provide a smaller script that produces the bug please. preferably less than
ten lines of code which requires nothing other than the bare min.. IE no extenal files
etc.
------------------------------------------------------------------------
[2001-07-22 00:23:57] [EMAIL PROTECTED]
Thanks for responding. I no longer have access to the FreeBSD FTP server that I was
connecting to, so it is no longer an issue (for me). My script is attached below.
If you do see an issue with the code, I am still interested in your response.
<?
$bDebug = 1;
$aDomain = array (
"xyz.com", "z"
);
if ($bDebug)
echo "Number in array =" . count ($aDomain) . "<BR>";
for ( $i=0; $i < count ($aDomain) ; )
{
if ( $bDebug )
echo "Openning \"" . $aDomain[$i] . "\"...<BR>";
$nFTP = ftp_connect ( $aDomain[$i] );
if ( $nFTP == 0 )
{
echo "Failed to open $aDomain[$i]. Aborting...<BR>";
exit();
}
$nResult = ftp_login ( $nFTP, $aDomain[$i+1], "password" );
if ( $nResult == 0 )
{
echo "Failed to login to $aDomain[$i]. Aborting...<BR>";
exit();
}
else
echo "Login to $aDomain[$i] succeeded.<BR>";
if ( $bDebug)
echo "<BR>ftp_pwd=" . ftp_pwd ( $nFTP ) . "<BR>".
$nResult = ftp_chdir ( $nFTP, "logs");
if ( $nResult == 0)
{
echo "ftp_chdir failed. Aborting...<BR>";
exit();
}
if ( $bDebug)
echo "<BR>ftp_pwd=" . ftp_pwd ( $nFTP ) . "<BR>".
$aFiles = Array( "Oct100.log.gz",
"Nov100.log.gz",
"Dec100.log.gz",
"mtd.log");
// $aFiles = ftp_rawlist ( $nFTP, "/mnt/web/guide/accumeddata/logs/*.gz");
// echo "rawlist = " . count ( $aFileList ) . "<BR>";
// $aFiles = ftp_nlist ( $nFTP, "*.gz");
if ( $bDebug )
{
echo "count(aFiles)=" . count ($aFiles ) . "<BR>";
for ( $j=0; $j <= count($aFiles); $j++ )
echo "$j=\"$aFiles[$j]\"<BR>";
}
// Get all the Monthly archives (*.GZ)
for ( $j=0; $j < count($aFiles); $j++ )
{
$sLocalFile = $aDomain[$i] . "-" . $aFiles[$j];
$sLocalFile = str_replace ( "/", "-", $sLocalFile );
$sRemoteFile = $aFiles[$j];
if ( $bDebug)
{
echo "sLocalFile=\"$sLocalFile\"<BR>";
echo "sRemoteFile=\"$sRemoteFile\"<BR>";
}
$nResult = ftp_get ( $nFTP, $sLocalFile, $sRemoteFile, FTP_BINARY );
if ( $nResult == 0)
{
echo "ftp_get failed. Aborting...";
exit();
}
}
// Get the current month also.
$nResult = ftp_get ( $nFTP, $sLocalFile, "mtd.log", FTP_BINARY );
if ( $nResult == 0)
{
echo "ftp_get of mtd.log failed. Aborting...";
exit();
}
$nResult = ftp_quit ( $nFTP );
if ( $nResult == 0 )
{
echo "ftp_quit failed. Aborting...";
exit();
}
$i = $i + 2;
}
?>
------------------------------------------------------------------------
[2001-07-21 21:27:45] [EMAIL PROTECTED]
Please submit a short script for me the analyze. This will
also clarify your bug a little bit.
------------------------------------------------------------------------
[2001-01-23 22:23:49] [EMAIL PROTECTED]
The ftp_nlist and ftp_rawlist functions failed to work for me. I am using PHP.EXE
v4.0.4 from a Windows 2000 machine connecting to a Free BSD box running the following
FTP server:
Our.ftp.server FTP server (Version wu-2.6.1(1) Mon Jul 3 03:07:01 EDT 2000)
Both ftp_nlist and ftp_rawlist return a single blank string ("") into the result
array.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=8874&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]