haaglin Posted November 19, 2006 Share Posted November 19, 2006 Hi. I'm developing an auto installer for my CMS system. The installer unpacks a zip file with the files, that i transfered to the server. And to get around permission issues, i unpacked the files into a temp dir, and i'm trying to move everything inside the temp dir, back to root with php's ftp functions. then delete the temp folder. My problem is that it only transfer a small amount of the files. i have tried the "set_time_limit(0);", but still only a few files get transfered, and i get no errors. I have narrowed it down to the ftp_put command, because making the folders works just fine. On my own server (php 5) , this works fine, but not on a server with php 4. If that makes a difference. Here is the script: [code]<?phpset_time_limit(0);function getmode($file) { $ascii = array('.asp$','.bat$','.c$','.cgi$','.cpp$','.css$','.dhtml$','.diz$','.h$','.htm$','.html$','.ini$','.mak$','.nfo$','.pas$','.php$','.php3$','.pl$','.sfv$','.shtm$','.shtml$','.tcl$','.txt$'); foreach($ascii as $ext) { if (eregi($ext, $file)) { return FTP_ASCII; } } return FTP_BINARY;}function move_recursive($from,$to) { global $conn_id; $to = str_replace("//","/",$to); $current_dir = opendir($from); while (false !== ($dir = readdir($current_dir))) { if ($dir !== '.' && $dir !== '..') { if(is_dir($from .'/'. $dir)) { ftp_mkdir($conn_id, str_replace("//","/",$to ."/". $dir ."/")); if(!move_recursive($from .'/'. $dir,$to .'/'. $dir)) { return false; } } else { $source = $from ."/". $dir; $dest = str_replace($_SERVER['DOCUMENT_ROOT'],"",$to ."/". $dir); $dest = str_replace("//","/",$dest); if(file_exists(str_replace("//","/",dirname($_SERVER['DOCUMENT_ROOT'].$dest)))) { ftp_put($conn_id, $dest ,$source, getmode($source)); } } } } closedir($current_dir); return true;}$ftp_server= "localhost";$ftp_user = "****";$ftp_pass = "****";$conn_id = ftp_connect($ftp_server); if (!ftp_login($conn_id, $ftp_user, $ftp_pass)) { echo 'Connection failed.<br>'; exit;}ftp_pasv ( $conn_id, true );if(move_recursive(realpath("../temp"),"/")) { echo "Finished.";}ftp_close($conn_id);?>[/code] Link to comment https://forums.phpfreaks.com/topic/27764-strange-problem-with-ftp_put-need-som-help-here/ Share on other sites More sharing options...
haaglin Posted November 19, 2006 Author Share Posted November 19, 2006 *bump* Link to comment https://forums.phpfreaks.com/topic/27764-strange-problem-with-ftp_put-need-som-help-here/#findComment-127142 Share on other sites More sharing options...
haaglin Posted November 20, 2006 Author Share Posted November 20, 2006 Sorry to bump again, but i have no idea what to do with this problem. Link to comment https://forums.phpfreaks.com/topic/27764-strange-problem-with-ftp_put-need-som-help-here/#findComment-127425 Share on other sites More sharing options...
haaglin Posted November 21, 2006 Author Share Posted November 21, 2006 This is the last entry in the pure-ftp log:[QUOTE]Nov 20 01:57:03 server10 pure-ftpd: (******@localhost) [NOTICE] *path to file* uploaded (1461 bytes, 7505.88KB/sec)Nov 20 01:57:03 server10 pure-ftpd: (******@localhost) [NOTICE] *path to file* uploaded (3945 bytes, 12553.86KB/sec)Nov 20 02:12:03 server10 pure-ftpd: (******@localhost) [INFO] Timeout - try typing a little faster next timeNov 20 02:28:58 server10 pure-ftpd: (******@******) [INFO] Timeout (no operation for 1800 seconds) [/QUOTE]I have searched everywhere for an answer, but it seems as if i am the only one with this problem? Link to comment https://forums.phpfreaks.com/topic/27764-strange-problem-with-ftp_put-need-som-help-here/#findComment-127873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.