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
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.
Type
php --ini
to find the configuration paths.Change
memory_limit
to whatever value you need.Make sure that you are changing it on both these files:
php.ini
andconf.d/php-memory-limits.ini
(in my case, I use -1 to have unlimited memory (of course, not unlimited but as much as my computer can handle))
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/
More information and explanation here:
http://www.mydigitallife.info/php-allowed-memory-size-exchausted-fatal-error/
Create a php file called test.php, put inside:
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:
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.
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)?
Try:
Unsure, but this came up in the google search for me:
http://wordpress.org/support/topic/plugin-cbnet-ping-optimizer-lots-of-errors-on-ping-optimizer-_help-please
The ping optimizer was cramming a table full on the DB and clearing solved the problem. The error was almost the same:
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.
Make sure you server/virtual server in apache is not configured to overwrite PHP configuration. Even if you use:
Your server may have something like:
which will make your changes in php.ini useless.
To fix this: