|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-10 13:06 UTC] guy dot vleugels at kaneka dot be
Description:
------------
After upgrading to PHP 5.2.2 on my RH9-machine the following error warning occurs on post-script files using ftp_get:
Warning: ftp_get() [function.ftp-get]: PORT command successful
As a result, the post-script file won't be downloaded to my machine.
If I do a downgrade to < PHP5.2.2, everything works perfectly.
Reproduce code:
---------------
$ftpcnn = ftp_connect("ftp-server", "4559");
// login with username and password
$ftprs = ftp_login($ftpcnn, "user", "passwd");
// check connection
if( (!$ftpcnn) || (!$ftprs) )
{
echo "FTP connection has failed!<br />";
exit;
}
// Firstly download txt-file
ftp_get( $ftpcnn, "/mydir/txtfile", "/ftpdir/txtfileonftp", FTP_BINARY );
// ---- Do some extra stuff -----------------------
// Get the name of the postscript-file
$lines = file( "mydir/txtfile" );
foreach( $lines as $line )
{
if( strstr($line, "!postscript") !== FALSE ) // ea. $line = "!postscript:0::docq/doc1764.ps"
{
$temp = explode( ":", $line );
$psfile = $temp[3];
}
}
// --- End some extra stuff -------------------
// Code which causes the warning:
// Warning: ftp_get() [function.ftp-get]: PORT command successful.
// Download the ps file
ftp_get( $ftpcnn, "/mydir/psfile", $psfile, FTP_BINARY );
// close the connection
ftp_close( $ftpcnn );
Expected result:
----------------
// Downloading of a file specified by arguments in ftp_get()
Actual result:
--------------
Warning: ftp_get() [function.ftp-get]: PORT command successful
File won't be downloaded
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
This should be a working example with existing files on our ftp-server. It reproduces the possible bug. Please change "<aCertainDirectory>" with a directory which is writable for you php-user. // --------------------------------------------------------------- // ftp connection $ftpcnn = ftp_connect("ftp.kaneka.be", "21"); // login with username and password $ftprs = ftp_login($ftpcnn, "anonymous", "myemailaddress"); // check connection if( (!$ftpcnn) || (!$ftprs) ) { echo "FTP connection has failed!<br />"; echo "Attempted to connect to the build-in ftp server of Hylafax!"; exit; } // Download q-file which contains name of ps-file ftp_get( $ftpcnn, "<aCertainDirectory>/q1950", "/pub/q1950", FTP_ASCII ); // Get the name of the postscript-file which contains the actual document data $lines = file( "<aCertainDirectory>/q1950" ); // file ? Reads entire file into an array foreach( $lines as $line ) { if( strstr($line, "!postscript") !== FALSE ) // ea. $line = "!postscript:0::docxxxx.ps" { $temp = explode( ":", $line ); $psfile = $temp[3]; echo $psfile; } } // Download the ps file ftp_get( $ftpcnn, "<aCertainDirectory>/$psfile", "/pub/$psfile", FTP_ASCII ); // ftp_get() retrieves a remote file from the FTP server, and saves it into a local file. // close the connection ftp_close( $ftpcnn ); // ---------------------------------------------------------