How to Increase File Upload Limit
When managing a virtual private server (VPS) for your WooCommerce store, it’s important to ensure that the file upload limit is high enough to handle heavy images and other attachments. Below, we’ll show you how to increase this limit using different methods.
1. Server Settings (php.ini)
The php.ini file is where PHP configuration parameters are specified on your server. To increase the file upload limit, follow these steps:
- Access your server via SSH.
- Locate the
php.inifile. It may vary depending on your server configuration but is commonly found at/etc/php/7.x/apache2/php.ini. - Open the
php.inifile with your preferred text editor. - Find the following directives and adjust their values as needed:
upload_max_filesize = 32M post_max_size = 32M
You can set the desired size instead of “32M”. For example, “100M” for 100 megabytes.
- Save the changes and restart the Apache web server for the settings to take effect.
2. .htaccess File
The .htaccess file allows you to configure specific settings for your website, including the file upload limit. Here’s how to do it:
- Access your server via FTP or SSH.
- Locate the
.htaccessfile in the root directory of your website. - If it doesn’t exist, you can easily create it with your favorite text editor.
- Add the following lines to the
.htaccessfile:php_value upload_max_filesize 32M php_value post_max_size 32M
Just like in the
php.inifile, you can adjust the values as needed. - Save the changes and close the file.
3. Using PHP
If you don’t have direct access to the server configuration or the .htaccess file, you can also adjust the file upload limit using PHP code in the file where you need it. Here’s how:
<?php ini_set( 'upload_max_filesize', '32M' ); ini_set( 'post_max_size', '32M' );
Simply place this code in the PHP file where you want to increase the file upload limit. For example, you can add it to the functions.php file of your WordPress theme.
Increasing the file upload limit on a VPS is crucial to ensure that WooCommerce can handle heavy images and other files efficiently. Whether through server configuration, the .htaccess file, or via PHP code, these methods will allow you to adjust the limit according to your specific needs. Optimize your online store and provide a seamless user experience for your customers!
