HomeWordPressHow To Fix upload_max_filesize error

How To Fix upload_max_filesize error

One common issue WordPress users encounter is the upload_max_filesize error. This error occurs when you try to upload a file that exceeds the maximum file size limit set by your web server. It can be frustrating, especially when you’re trying to upload media files, themes, or plugins. In this article, we’ll guide you through various methods to resolve this issue and increase the maximum upload file size limit in WordPress.

Causes of upload_max_filesize Error

The upload_max_filesize error in WordPress typically arises due to the following reasons:

  • Server Configuration: The web server has a default upload file size limit set by the hosting provider.
  • PHP Configuration: The PHP settings on the server define a limit for the maximum file size that can be uploaded.
  • WordPress Settings: WordPress has its own configuration settings that may restrict file uploads.

Editing php.ini

The php.ini file contains configuration settings for PHP on your server. Adjusting these settings can increase the maximum file size limit for uploads.

Editing php.ini via cPanel

  1. Log in to cPanel

    Navigate to your cPanel login page and enter your credentials.

2. Access MultiPHP INI Editor:

In the Software section, click on MultiPHP INI Editor.

3. Select Domain:

Choose the domain you want to configure from the dropdown menu.

4. Update Settings:

  • Scroll down and locate upload_max_filesize and increase its value.
  • Also update post_max_size to the same value and adjust memory_limit, max_execution_time, and max_input_time as needed.

5. Save Changes:

Click Apply to save the changes.

5 Verify:

Check the new upload limit in your WordPress dashboard under Media -> Add New.

Editing php.ini via Command Line (SSH)

  1. Connect via SSH

Use an SSH client/Terminal of cPanel to connect to your server.

2. Locate php.ini

Find the php.ini file, usually located in /etc/ or /etc/php/.

3. Edit File

Use a text editor like nano or vim to open the file

vim /etc/php/7.4/apache2/php.ini

4. Update Settings:

Modify upload_max_filesize, post_max_size, memory_limit, max_execution_time, and max_input_time.

php_value upload_max_filesize 1024M
php_value post_max_size 1024M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300

5. Save and Exit:

Save the changes and exit the editor.

6. Restart Server:

Restart the web server to apply changes

systemctl restart apache2

Edit .htaccess

The .htaccess file is used to configure settings for the Apache web server, including file upload limits. It is also used for URL redirection, custom error pages, and other web server directives.

Edit .htaccess via File Manager

  1. Log in to cPanel

Enter your cPanel credentials.

2. Access File Manager

Navigate to File Manager under the Files section.

3. Locate .htaccess

Find the .htaccess file in the root directory of your WordPress installation.

4. Edit File

Right-click the file and select Edit.

5. Add Directives

Add the following lines

php_value upload_max_filesize 1024M
php_value post_max_size 1024M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300

6. Save changes

Save the changes and close the editor

Edit .htaccess via Command Line (SSH)

  1. Connect via SSH:

Use an SSH client/Terminal of cPanel to connect to your server.

2. Navigate to Directory:

Change to the directory containing your .htaccess file, usually the root of your WordPress installation:

cd /path/to/your/wordpress

3. Edit .htaccess File

Use a text editor like nano or vim to open the file

vim .htaccess

Add the following lines

php_value upload_max_filesize 1024M
php_value post_max_size 1024M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300

4. Save changes

Once the lines are updated, Save the file and exit the editor.

Conclusion

Increasing the upload_max_filesize limit in WordPress involves modifying server settings through various methods. Whether you choose to edit the php.ini or .htaccess file via cPanel, command line, or File Manager, these adjustments will enable you to upload larger files and prevent the upload_max_filesize error. Always ensure you back up configuration files before making changes and verify the new settings in your WordPress dashboard. If you encounter difficulties, consider reaching out to your hosting provider for assistance. If you are a Veeble client we are always here to support you.

Scroll to Top