Many hosting services impose PHP memory limits for running applications.
When you encounter the error “The uploaded file exceeds the upload_max_filesize directive in php.ini” on your WordPress site, it means a file you’re trying to upload surpasses your web server’s set limits.
How to Resolve the upload_max_filesize Error #
The key to fixing this error is to increase the upload_max_filesize limit. Here’s a detailed look at how to do this.
Method 1: Modify the .htaccess File #
- Access your CPanel and navigate to File Manager in the Files section.
- Find and right-click the .htaccess file to edit it.
- Scroll to the end of the file, insert the following line, and then save your changes:
php_value upload_max_filesize 256M
Method 2: Alter the wp-config.php File #
To address the error regarding the upload_max_filesize directive in php.ini, you can change the wp-config.php file in your root directory.
- Log into CPanel, go to public_html, and open the wp_config.php file for editing.
- Insert the following line before “That’s all, stop editing! Happy publishing”:
@ini_set('upload_max_size' , '256M' );
After adding this line, save the file, refresh your browser, and try the upload once more.
Method 3: Update php.ini to Overcome the upload_max_filesize Error #
Alternatively, you can modify your PHP settings via the PHP Configuration tool in CPanel.
For VPS users or those on different platforms, updating the php.ini file can solve the issue. Here’s how:
- Locate and edit your php.ini file. If you can’t find it, seek help from your hosting provider.
- Find the upload_max_filesize line and increase its value. You might also want to enhance other limits as follows:
upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M
max_execution_time = 180
After making these changes, save the file. This should help you fix the error.
Leave a Reply