PHP / Apache: set max file upload and post size

Last updated on

Firstly, you need to locate your php.ini file. In this example, our php.ini file is located in /etc/php/7.2/apache2/php.ini

sudo nano /etc/php/7.2/apache2/php.ini

In nano, press CTRL + W and search for upload_max_filesize and change the value to 64M (for 64 megabytes).

/etc/php/7.2/apache2/php.ini
...
upload_max_filesize = 64M
...

Press CTRL + W again and search for post_max_size and change the value to 64M (for 64 megabytes).

/etc/php/7.2/apache2/php.ini
...
post_max_size = 64M
...

Save file and exit. (Press CTRL + X, press Y and then press ENTER

Restart Apache to apply changes.

sudo systemctl restart apache2

Let me know in the comments if this helped. Follow me @DevAnswers or read more.

1 Star2 Stars3 Stars4 Stars5 Stars 5.00 (3 votes)

Feedback

Your email address will not be published. Required fields are marked *

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces