If you’re running a WordPress site and encounter errors like "Allowed memory size exhausted" or "The uploaded file exceeds the upload_max_filesize directive in php.ini," it might be time to increase your WordPress memory limit and file upload size. Memory allocation defines how much server memory a WordPress site can use to execute its processes, while file upload size determines the maximum size of files you can upload via the WordPress dashboard. By default, these limits may not be sufficient for resource-intensive themes, plugins, or large media files. Here’s a step-by-step guide to increasing both.
The wp-config.php file is one of WordPress’s core files and controls many of its settings. To increase memory and upload size:
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');
The php.ini file configures PHP settings, including memory allocation and file upload size. If you have access:
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
The .htaccess file is used for server configuration. You can increase memory and upload size by:
php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
Most hosting providers offer user-friendly interfaces to configure PHP settings:
If you don’t have access to server files or the above methods fail, reach out to your hosting provider’s support team. They can adjust these limits for you.
To confirm that the memory limit and file upload size have been updated:
WordPress relies on PHP for processing tasks. Insufficient memory or upload size can cause errors, crashes, or failed uploads. Common scenarios where increasing these limits is essential include:
By increasing these limits, you can improve site stability, performance, and usability.
Increasing the WordPress memory limit and file upload size is a simple but effective way to resolve errors and improve your site’s performance and functionality. While methods like editing wp-config.php or .htaccess work well for many users, always ensure your hosting plan supports the changes. If unsure, consult with your hosting provider to avoid potential issues. With the right configuration, your WordPress site can handle larger workloads and deliver a smoother experience to users.
© 2025 - Ariful Islam | All Right Reserved