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:
- Create a new file: .user.ini
- Add the following PHP directives in your new file:
- memory_limit = 600M;
- upload_max_filesize = 400M;
- Upload the .user.ini file to your website’s root folder using FTP
- 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:
- Create a new file: phpinfo.php
- Add the following line to your new file and save:
- <?php phpinfo(); ?>
- Upload the phpinfo.php file to your website’s root folder using FTP
- 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:
And you’re done! Now you can continue uploading big files on your WordPress website.
No Responses