Skip to content

Defining the PHP memory_limit

Olivier Paroz edited this page Apr 15, 2016 · 5 revisions

If you get a message like this one,

"Allowed memory size of 536870912 bytes exhausted (tried to allocate 13743895345 bytes) at DOCROOT/lib/private/image.php#xxx"

it is likely that you have a PHP memory_limit set too low for your needs. Image processing requires a lot of memory.

Here is a quick Bytes to MegaBytes conversion table to make more sense out of these large numbers

Bytes MegaBytes
8388608 8
16777216 16
33554432 32
67108864 64
134217728 128
268435456 256
536870912 512
1073741824 1024

Understanding your requirements

In order to understand what your memory requirements might be, you should visit this website which lets you input an image's dimensions and the target size and will calculate how much memory the operation will require:

http://www.dotsamazing.com/en/labs/phpmemorylimit

Some examples

Those are the memory requirements when resizing to the default 2048x2048

MegaPixels MegaBytes
14.1 99
12.2 87
8.7 66

All those numbers are on top of what the process is already using for its normal operations. Usually 30-60MB

Adjusting the limit

Please refer to the ownCloud documentation to understand where you should modify the PHP memory_limit setting:

https://doc.owncloud.org/server/8.2/admin_manual/configuration_files/big_file_upload_configuration.html#configuring-php

Note: The syntax is different depending on where you make the modification.