How to increase and set upload size to 100MB in PHP-Apache

I am using Apache with mod_php on Debian/Ubuntu Linux server. How do I increase file upload size limit in PHP-Apache app from default 2MB to 100MB?

You need to edit the file called /etc/php/7.0/apache2/php.ini.

Increase file upload size limit in PHP-Apache

Type the following command to edit the php.ini:
$ sudo vi /etc/php/7.0/apache2/php.ini
Find and set the following two values:
post_max_size = 100M
upload_max_filesize = 100M

Save and close the file. Where,

  1. post_max_size = 100M :
  2. upload_max_filesize = 100M : Maximum allowed size for uploaded files.

Restart Apache server

Type the following command to restart the Apache2 server:
$ sudo service apache2 restart
$ systemctl restart apache2.service
Now you should able to upload file upto 100MB:

Fig.01: Changed upload_max_filesize on PHP

Posted by: SXI ADMIN

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...