WordPress is the best content management system to build websites of almost any type and complexity. It does not require deep knowledge of coding, so, it is the best choice for everyone. You can install WordPress manually or depending on your web host you can also install it in one click. At WPOven you can install a WordPress site to your server in a matter of seconds and easily manage it from our dashboard. Moreover, it is very customizable: you can easily change the interface or add new functionality just installing the new themes or plugins.
While uploading the files into WordPress, you may face the “the uploaded file exceeds the upload_max_filesize directive in php ini” error. What does this error mean? Why does WordPress display it? What are the ways to fix this error? Let’s look closer.
What is the uploaded file exceeds the upload_max_filesize directive in php ini error?
Depending on the platform you host your website on, your WordPress may have different maximum file size limits. In most cases, it is 64 MB, but sometimes it can be higher or significantly lower. How does it affect your work?
For example, in the WordPress configuration or php.ini file, you have the limit of 64 MB. And you are going to install the theme, plugin or just upload the media file which is bigger. In this case, the server will throw “the uploaded file exceeds the upload_max_filesize directive in php ini” error, and you will not be able to upload the file.
What are the ways to fix the issue? We’ll review four of them.
How to fix the uploaded file exceeds the upload_max_filesize directive in php ini
1 Editing the .htaccess file
.htaccess is an Apache Web server configuration file. It allows you to configure the settings for individual folders and users. The .htaccess file provides a wide range of website customization. Maximum file size is one of the parameters you can set up in this file.
You can find the .htaccess file is in the root folder of your website. To access it, you will require either an FTP manager or web interface given by the hosting provider. In the case of FTP manager, you will need the IP address, login, and password to connect remotely. Usually, this information is provided by the hosting . If you are a WPOven user you can get the SFTP details as mentioned here.
- Open the file in any text or code editor, like Sublime Text, Visual Studio Code, Notepad++, etc. Then find the upload_max_filesize line. It will look like that:
php_value upload_max_filesize 64M
- In some cases, the .htaccess file may not contain this line. Then, add it at the end of the document. Change the value to the one you really need. For example:
php_value upload_max_filesize 512M
If you did everything correctly, WordPress will not display this error anymore.
2 Edit the wp-config.php file
wp-config.php is the main configuration file of your WordPress website. It contains all the important parameters tool to make the website work correctly. It is also located in at the website root folder. Like a .htaccess file, you will need is an FTP manager or web browser if you access it online.
- Open the file in any text or code editor and find the following line:
- Right after that, add the line with maximum file size parameter:
@ini_set('upload_max_size' , '512M' );
You can use any appropriate value instead of 512M.
- Apply the changes, upload the file back to the server if you edited it offline, refresh the page, and try to upload the file again.
The uploaded file exceeds the upload_max_filesize directive in php ini error must be now solved.
3 Edit php.ini file
The uploaded file exceeds the upload_max_filesize directive in php ini error Meals that something wrong with a php.ini file is going. First, let’s find out what this file is for.
The php.ini file is the main PHP configuration file. WordPress uses the PHP programming language, and this file controls everything. Some hosting providers set up its configuration to the maximum parameters and do not allow to change it globally. However, in most cases it is possible.
If you do not know where the php.ini file is located on the server, do the following steps:
- Start a text editor and type the following line of code in it:
<?php phpinfo(); ?>
- Save the created file and name it info.php.
- Via the FTP manager, connect to the hosting server where your site is located and copy the info.php file to the website root directory.
- Now, in the address bar of your browser type http://example.com/info.php, where instead of example.com type in your website address.
As a result, the browser displays all the information about the PHP version used on the hosting, and information about its configuration. In the Loaded Configuration File column, it will display the path to the php.ini file on the host server.
Among other settings, check the value of the following three parameters:
- memory_limit — the maximum memory size allowed by the hoster to run scripts on the website;
- post_max_size — allowed size of a one-time file import request;
- upload_max_filesize — the maximum amount of data that can be uploaded to the site per time.
To increase the allowed maximum file size, you need to adjust the values specified in upload_max_filesize and post_max_size parameters. If you use the virtual hosting, most likely you will not have full access to the global server settings. As a rule, full access to this file is available on the local server or on a VPS hosting.
If you have access, open the php.ini file in edit mode and set the new upload_max_filesize and post_max_size values. The upload_max_filesize value should be less than post_max_size, and the post_max_size value should not be higher than the memory_limit. Do not forget to back up the site and save a backup copy of the php.ini file before you make any changes.
It must look like the following:
If you do not have access to the php.ini file, adjust the necessary values in the user.ini file. The path to it is indicated in the “Additional .ini files parsed” section when opening the info.php file. This method works for PHP version 5 or higher.
- Run a text or code editor and name the file user.ini.
- Add the necessary parameters to memory_limit, post_max_size and upload_max_filesize.
- Using the file manager, copy the user.ini file to the root directory of the site, upload the page and try to upload the file again.
4 Contact the support
In many cases, it will be much easier to contact the technical support of your hosting provider and ask them to solve the issue. Remember that they may possibly not be able to change the parameters if your plan does not allow to do that. In that case, you may require to change it.
The uploaded file exceeds the upload_max_filesize directive in php ini error is very easy to fix. All you need is several minutes of your time and some simple steps.