ID: 40389 User updated by: afuzaylov at mlgpro dot com Reported By: afuzaylov at mlgpro dot com Status: Open Bug Type: Unknown/Other Function Operating System: windows xp PHP Version: 5.2.0 New Comment:
Oops, I'm sorry, I forgot to define constants. Please put the following code on the second line of the code I just submitted above (right after <?php) define('FTP_SERVER', ''); define('FTP_USERNAME', ''); define('FTP_PASSWORD', ''); define('FTP_PATH', ''); // where to put your file on the server define('DIRECTORY_DESTINATION', ''); // where your file is currently located on your local machine Previous Comments: ------------------------------------------------------------------------ [2007-02-07 15:46:48] afuzaylov at mlgpro dot com Steps to reproduce: 1) Please download 32MB file from here: http://media.mlgpro.com/uv/2007/0206/117/1Adc06430e456ca66f8f572f6a5fe69308X0J500O1.swf 2) Save the following PHP script in the same dir with the above downloaded file. 3) Change values for constants to reflect your dirs and passwords. 4) Run the script and time the amount it will take to complete (be prepared to spend 3 hours if you will run into the same problem as I have). 5) Now run any other FTP program to FTP the same file to the same server. 6) Compare times. <?php function ftp($file_name) { $conn_id = ftp_connect(FTP_SERVER); $login_result = ftp_login($conn_id, FTP_USERNAME, FTP_PASSWORD); if ($conn_id && $login_result) { set_time_limit(60 * 60 * 4); // 4 hours from now $upload = ftp_put($conn_id, FTP_PATH . $file_name, DIRECTORY_DESTINATION . $file_name, FTP_BINARY); } ftp_close($conn_id); if ($upload) { return TRUE; } return FALSE; } $file_name = "test.swf"; $started = time(); $uploaded = ftp($file_name); $ttime = time() - $started; if ($uploaded) { echo "CONGRATULATIONS!"; } else { echo "FAILED!"; } echo " Total time took: $ttime seconds"; ?> ------------------------------------------------------------------------ [2007-02-07 15:35:02] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2007-02-07 15:26:37] afuzaylov at mlgpro dot com Description: ------------ Hi. I have created a small php file to FTP .swf files to another server. It seems to run very very slow compared to another FTP program. It takes filezilla 1.5 minutes to upload 31MB .swf file, while it takes PHP to upload it about 3 hours. I am running on windows xp apache2, PHP 5.2. Reproduce code: --------------- function ftp($file_name) { $conn_id = ftp_connect(FTP_SERVER); $login_result = ftp_login($conn_id, FTP_USERNAME, FTP_PASSWORD); if ($conn_id && $login_result) { set_time_limit(60 * 60 * 4); // 4 hours from now $upload = ftp_put($conn_id, FTP_PATH . $file_name, DIRECTORY_DESTINATION . $file_name, FTP_BINARY); } ftp_close($conn_id); if ($upload) { return TRUE; } return FALSE; } $file_name = "test.swf"; $uploaded = ftp($file_name); if ($uploaded) { // do something } else { // do something } } Expected result: ---------------- It should not take 3 hours to upload a file while it takes other FTP programs less than 2 minutes. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40389&edit=1