Change The Maximum Upload File Size in Php

This is annoying to get file exceeds the max size allowed when you try for uploading files. How can you be able to upload bigger files without any caution or error ? We have to find php.ini file from your system.

From terminal run this code : (For Total work you have to be in su mood in terminal)

find / -type f -name php.ini

In my system i got this :

/etc/php5/fpm/php.ini
/etc/php5/apache2/php.ini
/etc/php5/cgi/php.ini
/etc/php5/cli/php.ini

Now keep backup of those every file . How ? Do this : (Copy full text and paste in terminal and press enter)

mkdir /home/phpbackup;cp /etc/php5/fpm/php.ini /home/phpbackup;cp /etc/php5/apache2/php.ini /home/phpbackup;cp /etc/php5/cgi/php.ini /home/phpbackup;cp /etc/php5/cli/php.ini /home/phpbackup

Now edit every php.ini file and search for :

upload_max_filesize

post_max_size

How to edit ? let you want to edit /etc/php5/fpm/php.ini just do this :

nano /etc/php5/fpm/php.ini

and find upload_max_filesize by ctrl+w and paste in the box . change the value as you desire . You have to give double size of upload_max_filesize in post_max_size .

php-1php-2Edit like that and save the file and restart apache2 .

service apache2 restart

Thank You

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.