Increasing the upload_max_filesize
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
Connect to the terminal of your web sever.
Locate the php.ini
filer:
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
Open a php.ini file:
sudo nano /etc/php5/apache2/php.ini
Find the line upload_max_filesize = 2M
by using Ctrl+W
key combination.
That’s it:
; 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).
Restart your web server:
For Apache:
sudo service apache2 restart
or Nginx:
sudo service nginx restart
Try the upload again.
Conclusion
That’s it, you’re done. So simple isn’t it?
If you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!
If this article has helped you solve the problem then please leave a comment
Thanks for reading!
Arthur is a designer and full stack software engineer. He is the founder of Space X-Chimp and the blog My Cyber Universe. His personal website can be found at arthurgareginyan.com.