On Ubuntu server, maximal file size upload limit in php scripts is set to 2Mb as default. There may be different filesize updated later in php.ini which is not sufficient to upload large database backup in phpMyAdmin.
In order to change that, two things are important,
- Current upload_max_filesize value
- Current location of php.ini file
To find current upload_max_filesize value, create a file called ‘pinfo.php’ at your webserver root folder with following content:
Now, open recently created file in browser via
http://localhost/pinfo.php (replace localhost with the servername if necessary) and look for the line
which will show you the actual maximum file size.
To change the upload_max_filesize value, open php.ini file from the location provided in information displayed from pinfo.php file. If php.ini file location is/etc/php5/apache2/php.ini, then open a ssh connection to your server and edit the file
/etc/php5/apache2/php.ini as follows
sudo nano /etc/php5/apache2/php.ini
search for “upload_max_filesize” with Ctrl-W and change “2M” to “20M”. Save the file with Ctrl-O and exit with Ctrl-X. Restart the apache server with
sudo /etc/init.d/apache2 restart
and visit again
http://localhost/info.php to check if the maximum file size was changed.
There is another way to change upload_max_filesize value for specific project or website only.
If you enabled mod_rewrite you can also put this to your .htaccess file:
php_value upload_max_filesize = 16G
php_value post_max_size = 16G
So, upload_max_filesize value in php.ini file can be changed using .htaccess for project specific and from php.ini file itself for whole server specific.