It is often necessary to increase the upload size for PHP scripts. I find I have to do this with every Moodle installation but there are many reasons for increasing the upload size. Maybe you wrote your own PHP scripts that allow uses to upload files to your site or maybe you have a different program like Gallery, WordPress, or Joomla. What ever your reason it is very simple in Linux.
To increase the max upload size for PHP you have to edit the php.ini file with root privileges.
In Debian installations like Ubuntu you start your statement with sudo to evaluate your privileges to root or administrator.
In Ubuntu type this: sudo nano /etc/php5/apache2/php.ini
Press Ctrl and W to search for this variable: post_max_size
Now change the value to the number of Mb you want your site to accept as uploads like: 128M
Press Ctrl and W to search for this variable: upload_max_filesize
Change the value to the number of Mb you want your site to accept as uploads. Please note this should be the same as above such as: 128M
It may also be necessary to increase the execution time when you do this.
While still editing the php.ini file Press Ctrl and W and search for: max_execution_time
Now increase the value to something like: 600
Now save the file: Press Ctrl and O
Now you can exit the nano editor: Press Ctrl and X
Now just restart apache to load these new values: Type sudo /etc/init.d/apache2 restart
For other flavors of Linux such as Red Hat, Fedora, CentOS follow the same steps except you won’t use sudo. You can run the commands as root.