Fix Upload_Max_Filesize for WordPress on Windows Hosting

upload-icon-20606

 

I needed to upload a file on a WordPress website, and the following issue was showing up:

The uploaded file exceeds the upload_max_filesize directive in php.ini

 

All the solutions I found show how to update the php.ini file, but this only works on Linux Hosting. For Windows Server and Windows Hosting accounts, you need to follow the next steps to solve the issue:

  1. Create a new file: .user.ini
  2. Add the following PHP directives in your new file:
    • memory_limit = 600M;
    • upload_max_filesize = 400M;
  3. Upload the .user.ini file to your website’s root folder using FTP
  4. Recycle your website’s application pool

 

These values will override the the master values of the Windows hosting configuration. To test that these values are working fine, let’s create a new file:

  1. Create a new file: phpinfo.php
  2. Add the following line to your new file and save:
    • <?php phpinfo(); ?>
  3. Upload the phpinfo.php file to your website’s root folder using FTP
  4. Visit www.yourdomain.com/phpinfo.php

 

If everything is set up well, you can now see the updated values in your phpinfo page as follows:

phpinfo

And you’re done! Now you can continue uploading big files on your WordPress website.

Categories

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *