You could be doing everything right, but sometimes WordPress still displays errors. Not to worry, though. It may not be your fault and there’s an easy fix.
By default, WordPress has a modest limit for uploading images, videos, and other files. It’s a similar story for your PHP memory limit, which helps you run plugins and scripts.
If you run a robust site full of rich content, this could be a big problem for you when those limits are reached. You may receive an upload error that looks like this:
The uploaded file exceeds the upload_max_filesize directive in php.ini
If your memory limit has been reached, you may receive a different error that looks similar to this one:
Fatal error: Allowed memory size of 12345678 bytes exhausted (tried to allocate 2345678 bytes) in /home/your-username/public_html/wp-includes/plugin.php on line 1000
It can be a bit tricky to fix sometimes depending on your server setup, so let’s run through the most effective ways to increase your upload and memory limits on your server so you can get back to business as usual.
Note: If you’re still having trouble, we can help! Our support team is available 24/7 to help you with any WordPress issue (not just questions about our own plugins!), so whether you’re having problems with setting a memory limit or want some advice on how to do CSS tweaks, get in touch!
Let us help you, for free
The following are instructions on how you can edit php configuration files, .htaccess, WHM and wp-config.php to help resolve your issues.
Now, you wouldn’t be the first person to get pretty stressed at the very mention of those files and systems, let alone editing them for your live site.
But fear not! Help is at hand! You can try out a WPMU DEV membership for free today and our expert support team will guide you through how to edit the files, hold your hand while you do, help you fix up any issues and generally look after you, like we do all of our members.
Or go it alone, we won’t be offended :)
Updating Your php.ini File
If you use cPanel, go to the Files section and click on the File Manager button. Make sure the checkbox for Show Hidden Files is checked and then click Go.
Select your wp-admin folder and find a file called php.ini or php5.ini. If you don’t see it, create one by clicking the New File button in the top left-hand corner. Name the file php.ini and click the Create File button on the pop-up.
If you follow these instructions and it still doesn’t work, try renaming the file to php5.ini. Once the file is open, add or edit the following lines and then save and close.
The M means megabytes. Change the
3000M limit to the value with which you feel most comfortable. Changing the value of
max_execution_time will limit the amount of time spent loading a script in seconds.
In many cases, the values you enter should get larger as you go down the list from lines one to three. The
upload_max_filesize should be the smallest while
memory_limit should be the largest. The median should be
Before checking to see if the error is gone, clear your browser’s cache.
Editing Your .htaccess file
If that addition to your php.ini file doesn’t do the trick, try editing your .htaccess file and add or edit the following code at the very bottom:
Editing this code is similar to your php.ini file. Change the values to limits that best suit your needs. Don’t forget to save when you’re done and clear the cache for your browser.
Amending Your wp-config.php File
If both of these are a no-go, try editing your wp-config.php file, adding the following to the very bottom, but just before the “happy blogging” line:
Save the file and clear your browser’s cache.
Sign up for more
Changing the Limits in WHM
If your site is hosted on a VPS or dedicated server, you can try changing the upload and memory limits in your WHM.
Once you have logged in, go to Server Configuration > Tweak Settings > PHP.
Enter in the numbers that work for you and click Save at the bottom of the page.
Next, go to Service Configuration > PHP Configuration Editor. Scroll down until you find the core sections
Enter the correct values for your setup. Finally, in the Options & Information section, locate
max_execution_time and update it to the same value you tried in your php.ini and .htaccess files.
Click Save at the bottom of the page and clear your browser’s cache.
You’re all set now to resolve the error messages. Enjoy uploading larger files and continue using plugins on your WordPress site. These changes shouldn’t take more than a few minutes to take effect so you can quickly get back to work.
If you need to upload large files only once, you could also upload your files via FTP to avoid this problem altogether. Normally, files uploaded with FTP to the /wp-content/uploads/ directory aren’t displayed in the media library, but the Media from FTP plugin can register them into your library with just a few clicks. It’s a plugin that’s updated regularly and is compatible with single and Multisite installs of WordPress.
If none of these options work, you can’t access the areas mentioned or you have troubles along the way, get in contact with hosting provider. They have access to your server to make the required changes, so they’re your best bet.
Were you able to change your upload and PHP memory limit with these tips? Have you had troubles with this in the past? Feel free to share your experience in the comments below.
And remember, if you get at all stuck and would like a bit more help (we’ll even log into your site and fix stuff up for you!) then try out a free WPMU DEV membership today for 24/7/365 expert WP support :)