How to change default WordPress 2MB Upload on Self Hosted VPS php.ini

WordPress comes with 2MB upload size limit by default which needs to be increased if you want to upload files larger than that amount. The limit is set by your hosts php.ini file.

Login to your VPS via SSH and change your upload_max_filesize to something bigger such as 10Mb. 

You can customize this script to suit your needs:

#!/bin/bash -ex
#change the path an create a variable or hardcode it below.
#phpfilepath=/etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 200M/' /etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 200M/' /etc/php.ini

Restart your Apache2 or Nginx services.

Check php info or login to WordPress and test it.

🚀 **Support Our DevOps Blog with Your Amazon Shopping!** 🚀 Love shopping on Amazon? Now you can fuel your shopping spree *and* support our blog at no extra cost! Just use our link for your next purchase: **[Shop on Amazon & Support Us!] Browse Stuff on Amazon Every click helps us keep sharing the DevOps love. Happy shopping!

Leave a Comment