By tamarafield
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?
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!
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
.
upload_max_filesize = 50M
post_max_size = 50M
sudo systemctl restart apache2
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:
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
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.
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.
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
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.