Question

How to increase maximum file upload size for Wordpress site without a plugin

I need to increase the maximum file upload size on my droplet. DO will not help me. Can you please tell me how to do this?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
March 14, 2024
Accepted Answer

Heya @tamarafield,

You can achieve increasing the maximul file upload size from your php.ini file.

Enter your Droplet vie the console/cli (SSH). Once in there find your php.ini file. The location can vary based on your PHP version. Common paths are /etc/php/7.x/apache2/php.ini or /etc/php/8.x/apache2/php.ini.

  • Modify the following values (example sizes):
    • upload_max_filesize = 50M
    • post_max_size = 50M
  • Restart Apache to apply changes: sudo systemctl restart apache2

Thank you!

Bobby Iliev
Site Moderator
Site Moderator badge
March 13, 2024

Hey!

To increase the maximum file upload size for a WordPress site hosted on a DigitalOcean Droplet without using a plugin, you can modify the PHP configuration files directly. Here’s how you can do it:

  1. First, you need to SSH into your DigitalOcean Droplet. You can do this using a terminal or command prompt. Use the following command, replacing your_username with your actual username and your_droplet_ip with your Droplet’s IP address:

    ssh your_username@your_droplet_ip
    
  2. The PHP configuration file, php.ini, controls many PHP settings, including file upload limits. The location of php.ini depends on the PHP version and the server configuration. You can typically find it in /etc/php/{version}/apache2/ if you are using Apache or /etc/php/{version}/cli/ or /etc/php/{version}/fpm/ if you are using Nginx. You can use the php -i | grep "Loaded Configuration File" command to find the exact path.

  3. Once you’ve located the php.ini file, open it in a text editor like nano or vim. For example, if you’re using nano and PHP 8.1, you might use:

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

    Look for the following lines:

    • upload_max_filesize: This directive sets the maximum size of an uploaded file.
    • post_max_size: This directive sets the max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize.

    Increase these values as needed, for example:

    upload_max_filesize = 64M
    post_max_size = 64M
    

    Replace 64M with the size you need.

  4. After saving the changes, you need to restart your web server for the changes to take effect. The command to restart the server depends on the server you are using. For Apache, you can use:

    sudo systemctl restart apache2
    

    Or for Nginx:

    sudo systemctl restart nginx
    
  5. To ensure your changes are active, create a PHP info file (if you don’t already have one) and check the upload_max_filesize and post_max_size values. You can create a file named info.php in your WordPress root directory with the following content:

    <?php phpinfo(); ?>
    

    Access this file in your browser (http://yourdomain.com/info.php), and check the updated values. Don’t forget to delete this file after checking for security reasons.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel