The Uploaded File Exceeds the Upload_max_filesize Directive in Php.ini Localhost
Introduction
The Uploaded file exceeds the upload_max_filesize directive in php.ini error in WordPress, occurs when uploading big files, themes, or images. The issue is the outcome of a server-side setting that limits file sizes.
This guide provides six (6) solutions on how to accommodate the appropriate parameters and resolve the file size mistake.
Prerequisites
- A working WordPress installation
- Admission to the server that hosts the WordPress installation (local or SSH)
- If yous are working from a client system, a file manager (or cPanel)
- A user business relationship with sudo privileges
- Access to a control-line/concluding window (optional)
six Ways to Fix Uploaded File Exceeds upload_max_filesize error in WordPress
Use the WordPress dashboard to check your current maximum upload file size. Select the Media > Add New option, equally shown in the epitome beneath.
In this example, the maximum file size is limited to 232 MB. Information technology is non possible to change this setting using WordPress. We provided 6 uncomplicated solutions on how to configure maximum file size on your server.
Option ane: Edit the .htaccess File (cPanel)
i. Open cPanel and launch the file manager.
2. Correct-click the .htaccess file, then click edit.
Annotation: If you are non able to locate the .htaccess file, you may need to click Settings in the upper-right corner and check the box to evidence subconscious files.
three. Explore the file and find the line php_value upload_max_filesize. Edit the line to look every bit follows:
php_value_upload_max_filesize 256M
This instruction changes the server-side limit on the size of the file you lot're allowed to upload to 256 MB.
4. Save the changes and exit the file.
Option 2: Edit the .htaccess File using Command Line Interface
1. Access the server that hosts your WordPress site.
2. Enter the following command in your Command Line Interface to access the WordPress directory:
cd /path/to/wordpress
Note: The /path/to/wordpress is an case. Yous need to enter the right path to your WordPress directory.
3. Open the .htaccess file with a text editor of your choice. In this example, nosotros used the nano text editor:
sudo nano .htaccess
iv. Explore the file and find the line php_value upload_max_filesize. Edit the line and define the size you lot demand:
php_value_upload_max_filesize 256M
This instruction changes the server-side limit on the size of the file y'all are immune to upload to 256 MB.
five. Save the changes and exit the file.
Choice 3: Editing wp-config.php File
This method changes the limits on the PHP file size past editing the wp-config.php file directly:
1. Access the public_html folder using cPanel.
two. Find the wp-config.php file. Right-click the file and select the edit option.
Ringlet nearly to the end of the file and detect for the following annotate line:
/* That's all, stop editing! Happy blogging. */
3. Add together the following code but above that line:
@ini_set('upload_max_size' , '256M' );
iv. Salvage the file and exit. Try to upload your file again.
Option iv: Edit the wp-config.php File from Command Line Interface
ane. Access the server that hosts your WordPress site.
ii. Enter the post-obit control and admission the WordPress directory:
cd /path/to/wordpress
3. Open the wp-config.php file with a text editor of your selection.
sudo nano wp-config.php
iv. Find for the post-obit annotate line:
/* That's all, stop editing! Happy blogging. */
5. Add together the following line just above:
@ini_set('upload_max_size' , '256M' );
vi. Save the file and go out.
Option 5: Edit php.ini File
The php.ini file is a configuration file for PHP variables. The following steps show you how to edit the php.ini file:
ane. Log into your server hosting the WordPress site.
two. Admission the Control Line Interface, and enter the post-obit:
cd /etc/php/7.0/cli
Note: If you're running a different version of PHP, make sure to replace 7.0 with the version you are currently using.
3. Use a text editor to open the php.ini file:
sudo nano php.ini
4. Locate the post-obit line:
upload_max_filesize = 100M
5. Replace 100M with a higher value in megabytes. (256 MB for example)
This file allows you to configure other settings besides:
- memory_limit 256M – Sets the max corporeality of retentivity a script tin can employ.
- post_max_size 32M – Sets the max size for the full of the POST body data.
- max_execution_time 600 – Max time, in seconds, that a script is immune to run.
- max_input_time 900 – Max time, in seconds, that a script is allowed to parse input data.
half-dozen. Save the file and exit.
Test your file upload in WordPress – the event with file size is now resolved.
Option 6: Contact Host's Support
Information technology is non uncommon for hosting companies to set up limitations on the settings clients tin edit themselves. Depending on your particular hosting company, you might not be able to perform some of the actions described in the previous steps.
In those cases, it might be necessary to contact your host's support services. Well-nigh hosts perform this type of configuration as part of their standard service.
Conclusion
Now yous know how to ready the mistake "The uploaded file exceeds the upload_max_filesize directive in php.ini." in WordPress. This tutorial covered 6 dissimilar methods to increment the maximum file upload size.
Regardless of the chosen method, by following these uncomplicated instructions, you are at present able to define the maximum file size when uploading files to your website.
Was this article helpful?
Yeah No
Source: https://phoenixnap.com/kb/fix-the-uploaded-file-exceeds-the-upload-max-filesize-directive-in-php-ini-wordpress
0 Response to "The Uploaded File Exceeds the Upload_max_filesize Directive in Php.ini Localhost"
Postar um comentário