How to increase the max_input_vars in WordPress on Ubuntu 16.04

by

in

Increase the max_input_vars in WordPress can be done in several ways. Here is how to increase the max_input_vars value in different ways and then how to confirm the new value. This post is for Ubuntu 16.04 LTS with PHP7

 

Set the value in php.ini

 

In a VPN server you would set the value max_input_var in the php.ini file used by WordPress

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

Ctrl+W to find in Nano editor:

max_input_vars

Save and exit the file in Nano.

Then restart Apache

sudo service apache2 restart

 

 

 

Local php.ini file

Create a file inside the /wp-admin/ folder called php.ini
Add in this line:

max_input_vars = 3000

 

 

 

Increase max_input_vars using .htaccess

Use a text editor to add the following line to the .htaccess file.

nano .htaccess

Replace 3000 with the maximum number of input variables that you want to allow:

php_value max_input_vars 3000

Save the changes to the .htaccess file and exit the text editor.

 

 

 

How to verify the updated max_input_vars value

Create a file called phpinfo.php

nano phpinfo.php

Add this line of code into the phpinfo.php file

<?php phpinfo(); ?>

Navigate to  the file on your server for example www.example.com/phpinfo.php
Scroll down to till you find max_input_vars to verify that the  value is correct. Or use the search function in the browser and search for:

max_input_vars

 

 

 

Security tip

You should delete or rename the file phpinfo.php when the value of max_input_vars is verified to be correct. You don’t want to give the bad guys a tool to explore your server.

Source for the post about max_input_vars

 

The Broodle

 

Jonny Jordan

 

A2 Hosting