Solve File Exceeds the upload_max_filesize Directive in php.ini. Error

57

There are often times when we try to upload a file to our WordPress dashboard. But we get to see the File Exceeds the upload_max_filesize Directive in php.ini. Error. So the question is how to the fix File Exceeds the upload_max_filesize Directive in php.ini. Error?

Well if you have the same question in your head. Then read on, as we are going to discuss the fixes that can be used to fix the upload file size error. But before that let us talk about the reason behind the File Exceeds the upload_max_filesize Directive in php.ini. Error.

Why File Exceeds the upload_max_filesize Directive in php.ini. Error Occurs?

By default, our WordPress installation comes with a file upload limit of 50MB. Hence as a result whenever you try to upload files sized more than 50MB you get to see the File Exceeds the upload_max_filesize Directive in php.ini. Error.

However, this error can be fixed by doing some changes in the WordPress installation files. So let’s just go ahead and talk about these ways:

How To Fix The File Exceeds the upload_max_filesize Directive in php.ini. Error:

Editing the .htaccess file:

At first, let’s try editing the .htaccess file. Editing the .htaccess file is the quickest way to fix the file upload error in WordPress as it will help you to increase your PHP resources limit.

To edit the file, you have to access the root directory of your WordPress website using the file manager. Or you can use an FTP client. After that simply locate the .htaccess file and edit it.

If you are using the file manager, then you can simply right click on the file to edit it. For FTP connection, you can simply download the file and edit it using Notepad++.

Over here you have to increase the upload_max_filesize value. So simply add this following line at the bottom of your .htaccess file:

php_value upload_max_filesize 256M

After that simply save the file and you are done. Now go to your WordPress dashboard and try to upload the file again and see if it has fixed the issue or not.

code.jpg

If you still find the issue, then you can try changing the file parameters one by one. Simply try these following codes one by one and see which one is working for you.

php_value post_max_size 256M

php_value memory_limit 512M

php_value max_input_time 180

php_value max_execution_time 180

However, do not forget to save the files. Also, let us mention one thing, if you are using File manager then most probably you will not find the .htaccess file. As by default the dot files stays hidden in the file manager.

dot files.jpg

So to make the dot files unhide, you can click on your file managers settings option located at the right top corner. Then simply select Show Hidden Files (dotfiles) and you are done.

Editing the wp-config.php file:

The next thing that you could do to Fix The Uploaded File Exceeds the upload_max_filesize Directive in php.ini. Error is edit your wp-config.php file.

The file is also located in the WordPress directory. So you have to use the file manager or an FTP client to access it. Simply use any of the methods to access the wp-config.php file and open it.

Once opened, you will get to see several lines of codes. Over here you have to find a part that has “Happy blogging” words.

Then you have to add this following code after the part:

@ini_set(‘upload_max_size’ , ‘256M’ );

@ini_set('upload_max_size' , '256M' );.jpg

In the end, simply save the file and try to upload the file again. And see if you are still getting the same error or not.

Updating php.ini:

The last thing that you could do is edit your php.ini file. Even you look closely to the error then you will get to see the mention of php.ini file. Even it gives a hint that there is something to do with the php.ini file.

Well, php.ini is a file that holds all the php limit related variables, and by updating it, you can Fix The Uploaded File Exceeds the upload_max_filesize Directive in php.ini. Error. However, there are so many web hosting companies does not allow you to edit the file. But if you are using a VPS or some different hosting type. Then you might be able to update the php.ini file. Anyway, here are all the steps that you have to follow to update it:

  • First of all, go to your websites cpanel.
  • Over here you have to look for the MultiPHP INI Editor.

ini editor.jpg

  • Then you will get to see two options Basic Mode and Editor Mode.
  • From the basic mode select your domain.
  • After that, you will get to see several options. (Make sure you are not editing them)
  • Scroll down to the end of the options.
  • Then you will find the upload_max_filesize option as well as you will get to see the 50M value. Simply add your desired number.

50M.jpg

  • In the end, hit the Apply button and you are all set.

Now go ahead and check if it has solved the File Exceeds the upload_max_filesize Directive in php.ini. Error or not.

Contacting customer support:

As we have just mentioned that there are quite a lot of hosting companies that do not allow you to edit the php.ini files. So in such case, the only thing that you can do is contact the support team.

Explain your situation to them and mention all the fixes that you have applied. And they will guide you further with the fixes. However, in most of the cases editing the .htaccess file and wp-config.php file does the job. But if you need further assistance, then your web hosting provider is the person who can help you out.

Final Words:

So that was all for the question which says How to Fix The Uploaded File Exceeds the upload_max_filesize Directive in php.ini. Error.

Now go ahead and try these steps out and see how it is working for you. Also for any questions, you can feel free to leave a comment below, and we will surely help you out.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More