How to Increase upload_max_filesize for wordpress on Linux/cPanel Server

How to Increase upload_max_filesize for your WordPress/Magento/Joomla website on Linux/cPanel Server

upload_max_filesize is the maximum size of an uploaded file. On most of the server the default upload_max_filesize value will be too low. Log into your Linux server via SSH as root. First you must create a phpinfo.php file under your domain to check the current upload_max_filesize value. By default upload_max_filesize value of wordpress websites will be 2Mb

Go to document root of your website and create one phpinfo.php file.
 

[root@server ~]# cd /home/user/public_html
[root@server ~]# vi phpinfo.php

 
Enter the below content in phpifnfo.php file and save the file.
 

[root@server ~]# vi phpinfo.php
< ?php phpinfo(); ? >

[root@server ~]# chown user:user phpinfo.php

 
Now try accessing the phpinfo.php file in the browser to check the current upload_max_filesize value of your website. In the below screenshot you can see that upload_max_filesize of my website is 2M. To change the upload_max_filesize first you must check the loaded php.ini of your website.
 

Increase upload_max_filesize for website

Increase upload_max_filesize for website


 
Loaded php.ini of website

Loaded php.ini of website

php configuration of my website is in /usr/local/lib/php.ini. This is the server php.ini file and modifying any values in it will affect all the domains on the server. Create a custom PHP for your website and then edit the upload_max_filesize value. Do the below steps to create a custom php.ini file for your website.

Copy the php.ini file of your server to the document root of your website and then change the ownership of the file.
 

[root@server ~]# cp -a /usr/local/lib/php.ini /home/user/public_html
[root@server ~]# chown user:user php.ini

 
Try accessing the phpinfo.php file in web browser to make sure custom php is loaded.

Edit php.ini using vi editor and change the upload_max_filesize value to 30M (Any value)
 

Change upload_max_filesize for website

Change upload_max_filesize for website

Save the file and exit. Restart web server on the server and then check upload_max_filesize value in the phpinfo.php file.

How to Increase upload_max_filesize server-wide for all Domains

Log into your Linux server via SSH as root. Type the command “php –ini” to check the loaded php configuration file.
 

[root@server ~]# php –ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/curl.ini,

 
php.ini file of my website is in /etc/ directory. Edit the php.ini file using vi editor and change the upload_max_filesize.
 

Increase upload_max_filesize for All Domains (server-wide)

Increase upload_max_filesize for All Domains (server-wide)