Error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /home/ha084hcalf5z/public_html/wp-includes/meta.php on line 1194
There has been a critical error on this website. Please check your site admin email inbox for instructions.

Increasing PHP Memory Limit in WordPress
Understanding the Issue:
When your WordPress site encounters a “memory exhausted” error, it means it’s running out of the allocated PHP memory. This can be due to resource-intensive plugins, large images, complex themes, or heavy traffic.
Solutions:
Here are several methods to increase PHP memory limit:
1. Edit wp-config.php
- Pros: Easy to implement, often effective.
- Cons: Might not be sufficient for severe memory issues.
Add the following line before /* That's all, stop editing! Happy blogging. */
:
PHP
define('WP_MEMORY_LIMIT', '256M'); // Adjust the value as needed
Use code with caution.
2. Edit php.ini
- Pros: Directly sets the PHP memory limit.
- Cons: Often inaccessible on shared hosting.
Add or modify the following line in php.ini
:
PHP
memory_limit = 256M
Use code with caution.
3. Edit .htaccess
- Pros: Alternative method.
- Cons: Less reliable, might not work on all servers.
Add the following line to .htaccess
:
php_value memory_limit 256M
Important Notes:
- Start with a lower value (e.g., 128M) and gradually increase it if needed.
- Excessive memory allocation can impact server performance.
- Consider optimizing your website (image compression, plugin reduction) before increasing memory.
- If you’re on shared hosting, contact your provider for assistance.
Additional Tips:
- Use a plugin like WP Rocket or W3 Total Cache for performance optimization.
- Regularly update WordPress, themes, and plugins.
- Monitor your website’s resource usage.
By following these steps and considering the potential impacts, you can effectively address the PHP memory limit issue and improve your WordPress site’s performance.