Friday, May 1, 2015

How to increase max_input_vars in php

 Preparation

First create a info.php and write following line
 <?php  
  echo phpinfo();  
 ?>  


Upload info.php file on the directory of your server for which you want to increase max_input_vars. For example, if you want to increase for the root directory, upload info.php to the root directory. If you want to increase for a sub-directory like admin, then upload info.php to that (e.g. admin) directory.

 Now browse this uploaded file using a  browser http://YOUR_DOMAIN/info.php or http://YOUR_DOMAIN/YOUR_SUB_DIRECTORY/info.php depending on your path.  You will get a page like following:



Approach I



If you php is running on CGI/FastCGI , you can follow this approach

1. Create a file php.ini and upload on the server root directory. If php.ini file is already existed on the server, then don't need to create or upload new php.ini.
2.  Now add following lines in the uploaded php.info and save it
             
       max_input_vars = 10000;
3. if your php running on suhosin security module, you will have to add following lines as well

    suhosin.post.max_vars = 10000
    suhosin.request.max_vars = 10000

4. Run http://YOUR_DOMAIN/info.php again to see if the parameter increased correctly



Approach II

If you php is running on CGI/FastCGI , you can follow this approach as well

1. Create a file .user.ini and upload on the server root directory. If .user.ini file is already existed on the server, then don't need to create or upload new .user.ini
2.  Now add following lines in the uploaded .user.ini and save it
             
       max_input_vars = 10000;

3. if your php running on suhosin security module, you will have to add following lines as well

    suhosin.post.max_vars = 10000
    suhosin.request.max_vars = 10000

4. Run http://YOUR_DOMAIN/info.php again to see if the parameter increased correctly

Approach III

If you php is not running on CGI/FastCGI , you can increase using a .htaccess file

1. Create a file .htaccess and upload on the server root directory. If .htaccess file is already existed on the server, then don't need to create or upload new .htaccess
2.  Now add following lines in the uploaded .htaccess OR in the existing file and save it
             
       php_value max_input_vars 10000

3. Run http://YOUR_DOMAIN/info.php again to see if the parameter increased correctly

No comments: