I'm aware that this is a known problem but I was unable to address it using information found in WPAnswers and Wordpress support forums.

In my Worpdress single site installation the media uploader is always throwing an error at me

    out of memory (allocated 99614720) (tried to allocate 3760 bytes) 

the amount of allocated memory is more or less always the same - that should be about 96M... but in my server the php memory limit was set to 512M, post size is 12M, max upload size 8M

it's a VPN server and there's 1.5GB memory on it!

Wordpress throws the error also on images as small as 300-400K and under.

I tried using

    define('WP_MEMORY_LIMIT', '128M');

or

   define('WP_MAX_MEMORY_LIMIT', '128M');

but neither of these (alone or together) worked, in fact the error thrown was always the same and I had the impression Wordpress was disregarding both - I tried other settings too, the error was always the same and the amount of memory allocated more or less the same

I tried to change the php settings, like lowering the memory limit to 128M or bringing back again to 256M, restarting http service (apache) and restarting the whole server, but nothing changes

I proceeded to disable plugins, but the only way they don't seem ultimately responsible for the problem.

I decided to edit line 257 of media.php inside wp-includes folder, since the errors were always coming from line 258 which was executed thereafter

   @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );

I've replaced WP_MAX_MEMORY_LIMIT with values above 96MB for instance 128M or 256M

but no matter what, the allocated memory never exceeded 96MB. I tried lowering the WP_MAX_MEMORY_LIMIT to values such as 16M, 32M... anything below 96. Well! In that case the allocated memory resulted lower as in fact I was setting a lower limit - but how come it can't be more than 96? Still, I don't understand why wordpress takes so much, but nevertheless, why I'm not able to set to 128 and see if the problems are finally fixed? I'm only experiencing issues with the image uploader.

I've even tried to use

    @ini_set( 'memory_limit', '128M' );

in my wp-config but again it doesn't change the 96M limit... however it's able to lower it if I set to anything below 96 (resulting memory errors will state corresponding values)

I've run phpinfo from where my Wordpress installation is and the available memory is indeed that which is set on the server... 512M! so I don't understand why Wordpress seem to use less than that no matter what

any clues?

thank you

没有正确的解决方案

许可以下: CC-BY-SA归因
scroll top