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.

πŸš€ Join the DevOps Dojo! 🌟

Are you passionate about growth, learning, and collaboration in the world of DevOps? The DevOps Dojo is your new home! Whether you’re just starting out or looking to refine your skills, this vibrant community is here to support your journey.

πŸ”§ What You’ll Get:

  • Access to expert-led discussions
  • Hands-on learning opportunities
  • Networking with like-minded professionals

Ready to take your DevOps game to the next level? Click below to learn more and join the community!

πŸ‘‰ Join the DevOps Dojo Today

Let’s build, grow, and thrive together! 🌐

Leave a Comment