Welcome Guest, Not a member yet? Register   Sign In
Error using list_files() HELP!!
#1

[eluser]DiegoHF[/eluser]
Hi everybody
first of all, sorry about my english :-)

I got a problem this week using the list_files() function of FTP class, my problem is that I have a directory with a lot of archives and when a try to list these archrives the server returns me an error like this:
Code:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /home/frangofacio/www/nfe/sistema/libraries/Ftp.php on line 507

The line 507 is just the list_files() function!!!
someone knows how can I alocate more memory? I already tryed the ini_set() function of PHP but it does not work!!

Tanks for atention!!!
#2

[eluser]InsiteFX[/eluser]
Looks like your server ran out of memory! Add more memory to it.

You can edit the php.ini file and see if you can raise it up.

If you do not have access to the php.ini then call tech support!
#3

[eluser]DiegoHF[/eluser]
Ok man, I will try to do it, thanks for the fast reply!!
and its does not work do you know another way to solve this problem?
#4

[eluser]mejlo[/eluser]
it can be a loop problem,
try to check your "foreach", "while", "for" ... functions inside the "list_files" function
#5

[eluser]DiegoHF[/eluser]
Ok I am Checking, but I am only using the CodeIgniter's "list_files()" function, i think the error appear because i have 120.000 files into this directory....
#6

[eluser]Matt S.[/eluser]
In addition to InsiteFX's comment on adjusting the memory limit in your php.ini file, you can also temporarily bump up the memory limit for the script using the ini_set() function. Just place it at the top of your script:

Code:
ini_set('memory_limit', '128M');

$files = $this->ftp->list_files('/public/');

You may have to adjust the 128M option to allow more memory. Just be careful no to adjust it too far.
#7

[eluser]vbsaltydog[/eluser]
Do you really need to list 120k files?
#8

[eluser]DiegoHF[/eluser]
Thanks for the answer
I tried to use the ini_set() function but the server doesn't allow me to change the memory allocation, and int the future i will need to list more than 120k files... so i will try to use a database to save the files information!!

Thanks everybody for the attention!!




Theme © iAndrew 2016 - Forum software by © MyBB