Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
How to Solve WordPress Memory Errors
1. How to Solve WordPress
Memory Errors
1/9/2015
Brian Shim
brian.shim@live.com
@brianrshim
2. Has this happened to you?
Fatal error: Out of memory (allocated
63963136) (tried to allocate 7864320 bytes)
in [path]/wp-
content/plugins/wordfence/lib/wfBrowscapCach
e.php.php on line 16388
3. First, see how bad the problem is
• Use the TCP Memory Usage plugin
• https://wordpress.org/plugins/tpc-memory-
usage/
• Delete it after use (generates PHP warnings)
4. Solution #1: Delete unused plugins
• Usually doesn’t save much memory
• Might not have any unused plugins to delete
5. Solution #2: Increase WordPress’
memory in wp-config.php
/* Memory Limit */
define('WP_MEMORY_LIMIT', '96M');
• Uses more of your server resources
• Can bump into hardware limit
• Treats the symptom not the cause
• Check your PHP memory limit:
<?php phpinfo(); ?>
6. Solution #3: Get more server memory
• Costs $$
• Treats the symptom, not the problem
• Client may complain
7. Solution #4: Upgrade PHP to 5.4+!!
• Massive reduction in memory used from PHP
5.3 to PHP 5.4 – 18MB in my test case!
• Treats the cause, not the symptom!
• Free!
• Easy on some shared hosting; takes some
work for self-hosting
• PHP 5.3 is going EOL anyway
• YAY!!!!!
8. PHP 5.3 to PHP 5.4
Almost 18MB savings in my test!
9. More data to prove it
https://www.lourdas.name/blog/php-53-vs-54-
memory-usage-and-without-xcache-accelerator
10. Advanced:
How to upgrade PHP yourself
• Back up your server
• Yum remove httpd and php (site will go
down!)
• Re-install httpd, php, phpmyadmin
• Restore your httpd.conf settings
• This is big surgery, but worth it!
• http://brianshim.com/webtricks/update-
amazon-ami-php5-3-to-php5-4/
11. More Info
• Blog article:
http://brianshim.com/webtricks/reduce-
wordpress-memory-usage/
• Slideshare (soon):
http://www.slideshare.net/brianshim2