WordPress upload limit.

While I feel comfortable around Linux, reading ‘man’ entries and troubleshooting issues, I am not too familiar with websites.

I usually use flat-file apps and static websites, so WordPress and Apache stuff is pretty new to me, and more than a bit of an upward learning curve.

I identified an issue with file uploads – WordPress has a default file limit of 2mb , now I understand this will have been a huge limit in the early 2000’s but we are in the future now where all of the photo’s I take exceed this.

I did the sensible thing and turned to DuckDuckGo and searched for ‘how to increase WordPress upload limit Ubuntu Apache

Apparently there are 3 well documented ways to do this – 3!, all of which have varying levels of success. Rather than focus on what did not work for me , I thought I would describe what I did to increase my upload limit.

As I have access to the server my WordPress instance is on opened a terminal and ssh into the server.

I then opened the following file with my file editor

sudo nano /etc/php/8.1/apache2/php.ini

Yes, I use nano – it is the superior file editor for editing text files (bite me! Vim/Emacs users)

Then locate where upload_max_filesize = 50M is in the file.

You can do this with nano by using Ctrl+w and then typing “upload_max” and enter

Once you are at the “upload_max” line edit it as below and add the two lines below it

upload_max_filesize = 50M
post_max_size = 50M
max_execution_time = 300

You can change the 50M to the limit you need

The “post_max” line must be equal or greater than the upload limit

The “max_execution” line defines the maximum execution time for your PHP scripts and applications. If not configured, the default maximum execution time for a PHP script is 30 seconds. PHP will timeout and exit with a fatal error once it reaches the time limit.

Once you have completed your edit use Ctrl+x to prompt you to save your edits

After you have saved, restart Apache

sudo service apache2 restart

Then go check your media upload limit.

I hope this helps you like it did me.

Thanks for reading

Jase

1 thought on “WordPress upload limit.”

Leave a comment