How to Fix WordPress PHP Memory Limit & Timeout Errors
Step-by-step code overrides to quickly resolve "Maximum execution time exceeded" and "Allowed memory size exhausted" errors in WordPress.
Overview & Problem Matrix
Heavy page-builder plugins, resource-intensive e-commerce themes, or bulk backup and site-migration files frequently overload default server configurations, causing WordPress sites to crash.
When your hosting environment hits its native execution walls, your system throws fatal PHP exceptions such as Fatal error: Allowed memory size of X bytes exhausted or Fatal error: Maximum execution time of X seconds exceeded, alongside generic HTTP Error codes when dropping files into the media uploader.
Implementation Guide & Setup Steps
To increase your PHP threshold configurations and expand your server constraints, execute these site health operations:
- Method 1 - Apache Override (Recommended): Access your WordPress root directory via SFTP or your hosting File Manager. Open your
.htaccessfile and inject these runtime properties at the very top, directly before the# BEGIN WordPresssystem block:
# Increase PHP Resource Limits php_value memory_limit 512M php_value max_execution_time 300 php_value max_input_time 300 php_value upload_max_filesize 128M php_value post_max_size 128M
- Method 2 - Core Configuration Override: If your server host restricts global environment modifications inside
.htaccess, open yourwp-config.phpfile and add these definitions directly above the line that reads/ That's all, stop editing! Happy publishing. /:
// Apply structural memory constraints natively define('WP_MEMORY_LIMIT', '256M'); define('WP_MAX_MEMORY_LIMIT', '512M');
- Method 3 - Nginx & FastCGI Inode Overrides: If your server uses Nginx, create a raw text file named
.user.inidirectly within your public directory (/public_html) and apply these allocation values:
memory_limit = 512M max_execution_time = 300 max_input_time = 300 upload_max_filesize = 128M post_max_size = 128M
- Verify Asset Compliance: Log in to your WordPress Dashboard interface. Navigate to Tools > Site Health, choose the Info panel, and drop down the Server section to verify that your active configurations mirror your updated definitions.
Increase PHP Limits for WordPress
php_value memory_limit 512M php_value max_execution_time 300 php_value max_input_time 300 php_value upload_max_filesize 128M php_value post_max_size 128M
Community Engineering Notes
No technical implementations have been appended yet.