1

I am using the OMDB API (http://omdbapi.com/) to get movie images. I want to cache these so I can load them from my server. I am using PHP Image Cache (http://nielse63.github.io/php-image-cache/). But I am getting the following error:

Allowed memory size of 262144 bytes exhausted (tried to allocate 106496 bytes)

I have set memory_limit in my PHP file to 256, also have tried ini_set('memory_limit','1024M'); before the script runs and I still get the same error. And the allowed memory size of 262144 never changes.

How can I fix this?

Solution

I ended up finding the answer here: Allowed memory size of 262144 bytes exhausted (tried to allocate 24576 bytes)

What I don't really understand is why this fixed it? Changing memory_limit = 256mb to 268435456 but it has done the trick.

Community
  • 1
  • 1
MP_Webby
  • 916
  • 1
  • 11
  • 35

1 Answers1

1

What I don't really understand is why this fixed it? Changing memory_limit = 256mb to 268435456 but it has done the trick.

That happens because PHP can't understand your syntax. You must provide size properly as '256M' or '1G'. You could also do a trick like ini_set('memory_limit',256*1024); but the default measuring units would be generated by php settings