How to Increase max_input_vars in PHP Ubuntu

Websolutionstuff | Feb-02-2024 | Categories : Other

Hey folks! If you've ever encountered issues with PHP hitting the max_input_vars limit, you're not alone. In this guide, I'll walk you through the steps to increase the max_input_vars settings on Ubuntu. Let's dive right in!

So, let's see how to increase max_input_vars in php ubuntu, how to change max_input_vars in phpmyadmin, php max input vars, php.ini max_input_vars, how to increase max_input_vars in php.

You can use this command with your Ubuntu 16.04, ubuntu 18.04, ubuntu 20.04, ubuntu 21.04, ubuntu 21.10, ubuntu 22.04, or ubuntu 22.10.

Find PHP Configuration File:

First, we find the PHP configuration using the following command.

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

In most Ubuntu setups, the configuration file is located at /etc/php/{PHP_VERSION}/apache2/php.ini. Open your terminal and use your favorite text editor to open the file:

sudo nano /etc/php/{PHP_VERSION}/apache2/php.ini

Replace {PHP_VERSION} with your PHP version, for example, 7.4 or 8.0.

 

Step 2: Find max_input_vars Setting

Now that you're in the PHP configuration file, look for the max_input_vars setting. You can use Ctrl + W in nano to search. It should look something like this:

post_max_size = 100M
upload_max_filesize = 100M
max_file_uploads = 20
max_input_vars = 1000
memory_limit = -1

 

Step 3: Update max_input_vars Value

Increase the max_input_vars value to meet your application's needs. For example, set it to 5000:

max_input_vars = 5000

Feel free to adjust this value based on your specific requirements.

 

Step 4: Save and Close

Save the changes by pressing Ctrl + X, then press Y to confirm, and finally press Enter to exit.

 

Step 5: Restart Apache

For the changes to take effect, you need to restart the Apache web server. Run the following command in your terminal:

sudo service apache2 restart

If you're using Nginx or another web server, adjust the command accordingly.

 

Step 6: Verify the Changes

To ensure that the changes have been applied, create a simple PHP script (e.g., phpinfo.php) in your web server's root directory with the following content:

<?php
phpinfo();
?>

Access this script in your browser and search for "max_input_vars" to confirm that the new value is reflected.

And there you have it! You've successfully increased the max_input_vars in PHP on Ubuntu. If you ever need to adjust it again, just revisit the configuration file and make the necessary changes.

Happy coding! 🚀

 


You might also like:

Recommended Post
Featured Post
How To Convert Image To Base64 In Laravel 9
How To Convert Image To Base64...

In this article, we will see how to convert an image to base64 in laravel 9. Here, we will convert the image to bas...

Read More

Dec-29-2022

How to Create Apexcharts Line Chart in Laravel 11
How to Create Apexcharts Line...

Hello developers! In this article, we'll see how to create apexcharts line chart in laravel 11. ApexCharts is a...

Read More

Apr-22-2024

How To Install Yajra Datatable In Laravel 10
How To Install Yajra Datatable...

In this article, we will see how to install datatable in laravel 10. Here, we will learn about the laravel 10 yajra data...

Read More

Mar-01-2023

How To Copy Text To Clipboard In React JS
How To Copy Text To Clipboard...

In this article, we will see how to copy text to the clipboard in react js. you will learn how to copy text to...

Read More

Aug-31-2022