Fatal error: Allowed memory size of bytes exhausted. Increase the Maximum File Upload Size in WordPress

Does your WordPress site show an error message similar to this?

fatal error- allowed memory1. Increase PHP Memory Limit in WordPress, wp-config.php file

you need to paste this code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’

define('WP_MEMORY_LIMIT', '128M');

This code tells WordPress to increase the PHP memory limit to 128MB.

2: Theme Functions File

By adding the following code in theme’s functions.php file, you can increase the upload size:

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

3. Create or Edit an existing PHP.INI file

In most cases if you are on a shared host, then you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder (sometime in wp-admin folder do the tricks). In that file add the following code:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Remember if 64 doesn’t work, then try 10MB (sometimes that work).

4. htaccess Method

Edit the .htaccess file in your WordPress site’s root folder and add the following code:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

If you are on a shared hosting package, then these techniques may not work all the time. In that case, you would have to contact your web hosting provider to increase the limit for you.

Reference blog post: https://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/

Tawfiqur

I'm a freelance Wordpress Front-end Developer, work from my home office. Mostly do my freelance work on Upwork. I'm a TOP RATED freelancer with over 11K+ Work Hours. Specialize in HTML5, CSS3, SCSS, JavaScript, jQuery, Ajax, ES6, Bootstrap, PHP, MySQL, Wordpress, Woocommorce and Custom Wordpress Theme and Plugin Development

Leave a Reply

Close Menu