I've assigned the memory limit of php to 999m so it appears in phpinfo like
memory_limit 999M 999M
when I use phpinfo(); to show it.
Unfortunately when I try to run a fairly large script, it seems like the limit is 256M
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 40 bytes) in /xxx/wp-includes/wp-db.php on line 1403
Anyone have any ideas why or what I can do to increase the limit (and have it actually work)
If it helps I'm running centos5 32bit and with php running in fcgi mode
memory_limit 999M 999M- surely you meant
memory_limit 999Md_inevitable 2012-04-03 20:33
ini_set('memory_limit', ...)- kuba 2012-04-03 20:35
php_admin_value[memory_limit]=32Mjohn 2017-06-13 09:56
Create a php file called test.php, put inside:
<?php phpinfo(); ?>
Check for "Configuration File (php.ini) Path" and "Loaded Configuration File" to see the correct php.ini path. Edit php.ini and search for memory_limit and set it to:
memory_limit = 999M
Check if you have more than one occurrency of memory_limit into the php.ini file. In the case, delete it.
Stop apache, and then restart it (apachectl restart | apachectl graceful | kill -1 are not ok. Stop, then start).
Recheck test.php to see if the new parameter got acquired.
I had a similar issue, for me it was an extra ini file that was loaded called "99-liip-developer.ini". At the top of the file the memory_limit was defined at 265M, which overwrote the memory_limit defined in php.ini.
Hope this helps anyone.
I suggest you set this on the top of your script:
in the script that is consuming so much of your memory instead of allowing all scripts to consume so much memory. You can also put this in the .htaccess of your /wp-includes/
php_value memory_limit 512M
More information and explanation here: http://www.mydigitallife.info/php-allowed-memory-size-exchausted-fatal-error/
define('WP_MEMORY_LIMIT', '64M');in that file for example - ArendE 2012-04-03 20:49
You can try putting this at the top of your file
How much system memory do you have available? Did you restart Apache after editing your php.ini file (I assume you have php installed as a module)?
sudo /etc/init.d/httpd restart
Unsure, but this came up in the google search for me:
The ping optimizer was cramming a table full on the DB and clearing solved the problem. The error was almost the same:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 80 bytes) in /home/user1/public_html/domain/wp-includes/wp-db.php on line 1400
So see if a plugin is doing the same, then clear it and log it on WP somewhere so it can be fixed if that is the problem.
ini_get('memory_limit')to check it - craniumonempty 2012-04-03 21:09
Make sure you server/virtual server in apache is not configured to overwrite PHP configuration. Even if you use:
php_value memory_limit 512M
Your server may have something like:
php_value memory_limit 32M
which will make your changes in php.ini useless. To fix this:
php -i(note, that the different sapis (apache-module,
cli, ...) use different
php.inis)) You restarted your server? You ever thought about, why your scripts requires sooo much memory? - KingCrunch 2012-04-03 20:33