How To Increase PHP File Upload Limit on CentOS 7 with one line of bash.
SSH into your server as root and execute the following command:
[cce_bash]replace “upload_max_filesize = 2M” “upload_max_filesize = 20M” — /etc/php.ini && service httpd restart[/cce_bash]
That will replace your 2mb upload limit with a 20mb upload limit and it will restart the web server so changes to php.ini are made:
Done.
P.S. you can verify your new maximum PHP file upload size is by executing:
[cce_bash]grep upload_max_filesize /etc/php.ini[/cce_bash]
Sample output:
[cce_bash]upload_max_filesize = 20M[/cce_bash]
Universal way to increase PHP Upload Limit:
SSH into your server as root. Use vi or nano to edit the php.ini file:
[cce_bash]
vi /etc/php.ini
[/cce_bash]
Press / and type upload_max
(Pressing backslash (/) allows you to search a file while editing with Vi)
You should see:
[cce_bash]upload_max_filesize = 2M[/cce_bash]
Press i and change that value to 20M
(Pressing “i” allows you to insert type in characters while editing with Vi)
[cce_bash]upload_max_filesize = 20M[/cce_bash]
To exit Vi, press Esc and type [cce_bash]:x[/cce_bash] and hit enter.
Now either [cce_bash]reboot[/cce_bash] your server or restart httpd:
[cce_bash]service httpd restart[/cce_bash]
Your PHP upload limit is now 20mb.