You may receive the below error when attempting to upload files via the WordPress Add New Media page. The error is fairly specific regarding what the issue is however you may be unfamiliar with how to resolve the issue so below I will explain how to modify php.ini and resolve the error.
WordPress Media Upload Error: The file is to big. Your php.ini upload_max_filesize is 2M.
I received the above error after moving a development site live onto a new server. The default PHP upload_max_filesize as configured in php.ini is two Megabytes. Typically php.ini can be found in the /etc/ directory so you should modify /etc/php.ini.
Default php.ini upload_max_filesize Configuration:
; Maximum allowed size for uploaded files. upload_max_filesize = 2M
Modified php.ini upload_max_filesize Configuration:
; Maximum allowed size for uploaded files. upload_max_filesize = 20M
After making the change make sure to restart Apache which can be done by using the below syntax.
Restart Apache Using HTTPD Init Script:
[root@live site]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@live site]#
As you can see above the setting has been modified to now allow 20 Megabyte file uploaded via PHP. You can set this to whatever you like but make sure to not make it larger than necessary.The file I was attempting to upload was around 8MB and as you can see in the below image I was now able to upload it via the WordPress Add New Media page after making the above mentioned changes.
Successful Upload Of File Via WordPress Add New Media Page: