How to Increase upload_max_filesize in PHP Ubuntu?
Hey Folks,
Now, let's see an example of ubuntu php.ini file upload_max_filesize increase. This post will give you a simple example of change upload_max_filesize in php.ini ubuntu. I explained simply step by step increase upload_max_filesize in ubuntu php. you can understand a concept of how to change upload_max_filesize in php.ini ubuntu. So, let us dive into the details.
By default, PHP has limitations for max post file upload, upload max filesize, etc. If you would like to increase the size of post_max_size, upload_max_filesize, max_input_vars, memory_limit and max_file_uploads, then I will show you few steps to make it change the value of php.ini file.
You can use this command with your ubuntu 22.10, ubuntu 22.04, ubuntu 21.10, ubuntu 21.04, ubuntu 20.04, ubuntu 18.04 and ubuntu 16.04 server.
You need to follow the below steps:
Find PHP Configuration File Location:
Here, you need to run the following command to get the currently loaded php.ini file in your ubuntu system.
php -i | grep php.ini
You will find the following output and copy the loaded php.ini file path:
Configuration File (php.ini) Path => /etc/php/8.1/cli
Loaded Configuration File => /etc/php/8.1/cli/php.ini
Update php.ini File:
Here, you need to run the following command to open the php.ini file and update it using the nano command:
sudo nano /etc/php/8.1/cli/php.ini
Next, the php.ini file will open, find the following variable, and update the value:
post_max_size = 100M
upload_max_filesize = 100M
max_file_uploads = 20
max_input_vars = 200
memory_limit = -1
Then save it.
Restart Apache Server:
Next, restart your apache server using the following command:
sudo service apache2 restart
Now, you can check it.
I will work.
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Check Current PHP Version in Ubuntu?
- How to Upgrade PHP Version from 8.0 to 8.1 in Ubuntu?
- How to Generate SSH Key in Ubuntu Server?
- How to Restrict/Block IP Address in Apache Ubuntu?
- How to Install Laravel in Ubuntu Server?
- How to Change PHP Version in Ubuntu Server?
- How to Install Phpmyadmin in Ubuntu Server?
- How to Connect SSH using ppk File Ubuntu?
- How to Connect to a Remote Server using SSH on Ubuntu?
- How to Upgrade PHP Version from 7.4 to 8 in Ubuntu?
- How to Upgrade PHP Version from 7.2 to 7.3 in Ubuntu?
- How to Enable Apache mod_rewrite Module in Ubuntu?
- How to create virtual host in ubuntu apache?
- How to Enable Rewrite Mode for Apache in Ubuntu?