The default upload file size for php (and, consequently, for WordPress) is 2 MB, which is a problem if you want to upload a files that’s bigger. Follow these steps if you get this message:
The uploaded file exceeds the upload_max_filesize directive in php.ini
Step 1. Connect to the terminal of your web sever.
Step 2. Locate the
sudo find / -name "php.ini"
Examples of output:
/etc/php5/apache2/php.ini /etc/php5/cli/php.ini /etc/php5/fpm/php.ini /etc/php5/cgi/php.ini
Step 3. Open a php.ini file:
sudo nano /etc/php5/apache2/php.ini
Step 4. Find the line
upload_max_filesize = 2M by using
Ctrl+W key combination.
; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M
and replace it with a higher value, for example:
; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 10M
Save the changes to the file (press
Ctrl+O to write out and
Ctrl+X to exit).
Step 5. Restart your web server:
sudo service apache2 restart
sudo service nginx restart
Done! Try the upload again.
If this article helped you solve the problem then please leave a comment
Thanks for reading!