Category Archives: allocation

PHP Allocationg memory in WP does not work [duplicate]

This question is an exact duplicate of:

I'm running a Wordpress (WP) site and I am the root user of the VPS that is running right now.

So, when I am up to publish/create a new page it returns me the following message:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /home/.../public_html/wp-includes/compat.php on line 123

I have already search and read a various of articles about that problem. So I have done the following things:

From my whm -> php configs And I have allocate in memory_limit : 512M

Also, I have define at the top in wp-config.php file the following command:

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

However, I am still getting the error.

Additionally, I tried to insert the following in my .htaccess but it didn't work.

<IfModule mod_php5.c>
     php_value memory_limit 512M

I have allocated more than 1GB but it didnt work.

Also, I have re-install the whole WP framework to the latest version.

Plus, I have restart the apache a couple of times to see the current setting on php, but i think that is not necessary. Right?

I have add the plugin: WP Overview (lite) to see the php allocation and I have that values:

Mem: WP 512M (def) Usage 16% 81.03M of PHP Limit 512M

Finally, I have created 2 test files to see the allocation:


<? phpinfo(); ?>

It returns that I have 512M php allocation which is correct.

File2: <?php echo memory_get_usage(); ?> which returns


Is the this returning correct?? I thought that it should return 512M in bytes.. Right?

Any idea about the problem ? I am stacked on this issue.