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!
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.
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 andyour_droplet_ip
with your Droplet’s IP address:The PHP configuration file,
php.ini
, controls many PHP settings, including file upload limits. The location ofphp.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 thephp -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: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 thanupload_max_filesize
.Increase these values as needed, for example:
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:
Or for 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
andpost_max_size
values. You can create a file namedinfo.php
in your WordPress root directory with the following content: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
Thank you!