ftp_rawlist not running for huge directories

346 Views Asked by At

I am trying to get a list of files in the directory using ftp_rawlist(). The script is returning the file list with ftp_nlist(). But with ftp_rawlist() it doesn't returns anything. The directory which I am trying to get rawlist has 100k files.

Here is the code which I tried.

<?php 
 ini_set("memory_limit", "1024M");
 ini_set('max_execution_time', 0); //0=NOLIMIT
 set_time_limit(0);// no limit
 $conn_id = ftp_connect("xxxxx.xxx");
 $result = ftp_login($conn_id, "username", "password");
 ftp_pasv($conn_id, true);
 $ftpnlist = ftp_rawlist($conn_id, "/directory");
 var_dump($ftpnlist); //it throws false
 ?>
0

There are 0 best solutions below