Have you ever tried uploading something to your WordPress website and encountered a message saying, "the uploaded file exceeds the upload_max_filesize directive in php.ini"?
Don't worry, we're here to help you resolve this issue so you can easily upload larger files to your WordPress site. In this guide, we'll cover:
- Why you see the "uploaded file exceeds the upload_max_filesize directive in php.ini" error.
- How to fix this error and increase the file upload size limit.
Understanding the Error
To keep servers running smoothly, hosting providers set a limit on the maximum file size that can be uploaded. This limit, measured in megabytes, is controlled by a setting called upload_max_filesize in the php.ini configuration file. The php.ini file is a configuration file used by applications that require PHP, and it plays a crucial role in this error message.
It's important to note that this upload limit is not specific to WordPress; it's a server-wide setting. You can find this limit displayed in your WordPress dashboard under Media → Add New.
For example, some hosting providers might set the default limit at 2 MB or 4 MB, while others, like Kinsta, might have a higher limit, such as 128 MB.
Fixing the Error
To resolve the "uploaded file exceeds the upload_max_filesize directive in php.ini" error, you'll need to increase the file upload size limit. Here are a few methods to do that:
Contact Your Hosting Support: One of the simplest ways is to reach out to your hosting provider's support team. They can easily adjust the limit for you. If you're a Kinsta user, you can do this by sending a support message within the MyKinsta dashboard.
Edit php.ini via cPanel: If your hosting uses cPanel, you can edit the
php.inifile through the MultiPHP INI Editor. After selecting your WordPress site, locate and modify theupload_max_filesizesetting to your desired value.Create or Edit php.ini via FTP: Connect to your server using FTP and navigate to your site's root folder. You might find an existing
php.inifile or need to create a new one. Add or adjust the following lines to suit your needs:makefileupload_max_filesize = 12M post_max_size = 13M memory_limit = 15MSome hosts might require additional steps, such as adding the suPHP directive to your site's
.htaccessfile.Edit .htaccess File: If the above methods don't work, you can edit your site's
.htaccessfile. Connect to your site via FTP, locate the.htaccessfile in the root folder, and add the following lines:php_value upload_max_filesize 12M php_value post_max_size 13M php_valuememory_limit 15MRemember, if this causes an internal server error, your server might be running PHP in CGI mode, which won't support these commands in
.htaccess.
Checking Your Changes
To confirm that your changes are effective, return to your WordPress dashboard, navigate to Media → Add New, and see if the new maximum upload limit matches the value you set in the configuration file. If successful, you should now be able to upload larger files without encountering the error.
In case none of the methods work and your hosting support is unable to assist, you can always use FTP to upload files as a workaround. FTP doesn't have the same limits and allows you to upload a variety of files, from images to plugins and themes. It's a reliable option for managing large uploads.
By following these steps, you can easily overcome the "uploaded file exceeds the upload_max_filesize directive in php.ini" error and continue uploading files to your WordPress site without any hassle.