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:

  1. Access your server via SSH.
  2. Locate the php.ini file. It may vary depending on your server configuration but is commonly found at /etc/php/7.x/apache2/php.ini.
  3. Open the php.ini file with your preferred text editor.
  4. 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.

  5. 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:

  1. Access your server via FTP or SSH.
  2. Locate the .htaccess file in the root directory of your website.
  3. If it doesn’t exist, you can easily create it with your favorite text editor.
  4. Add the following lines to the .htaccess file:
    php_value upload_max_filesize 32M
    php_value post_max_size 32M

    Just like in the php.ini file, you can adjust the values as needed.

  5. 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!

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Back to Top
0
Would love your thoughts, please comment.x
()
x