4

I am doing a file resizer feature, and when I use very high resolution images, I get this fatal error:

PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to
 allocate 8884 bytes) in /path/resizer.php on line 35

(resizer.php is the resizer class) Then, when I use ini_set('memory_limit', '64MB');

.. in front of the whole block: if (isset($_FILES....)) ... And i get this fatal error:

 PHP Fatal error:  Allowed memory size of 262144 bytes exhausted (tried to 
allocate 8884 bytes) in path/resizerenter code here.php on line 35

Please note that the allocated memory has decreased while I requested an increase. Please let me know if you know what is wrong. Thanks a lot

alexx0186
  • 1,557
  • 5
  • 20
  • 32

1 Answers1

3

check the php.ini setting: memory_limit

Maybe is already more than 64M. In case you can

   ini_set('memory_limit', '128M'); or 256...

Operations with big images can happen to use huge memory!

Caspar Harmer
  • 8,097
  • 2
  • 42
  • 39
ab_dev86
  • 1,952
  • 16
  • 21
  • Hi thanks for your response. I realized, it it set to 32MB! I have a question, is RAM we are talking about? Thanks a lot – alexx0186 Mar 29 '12 at 17:10
  • Yes this is RAM. ini_set('memory_limit', '128MB') tells php engine that a single execution can use maximum 128MB of ram. This guarantees that a script happens to use to much memory causing problems to system's performance. – ab_dev86 Mar 29 '12 at 19:54