简体   繁体   中英

Increasing max_input_var in php.ini in XAMPP

I need to increase max_input_var in php.ini . I am ruining xampp php version 5.6.3

I have several website folder on my local, and I am confused if I need to have php.ini file per website or its a single master file.

I found php.ini file in xampp/php folder on localhost. I edited and increased it there, restarted but php.info still says the default value 1000. I needed to be 2000 or more.

I guess my next question is how should I do this from CPanel when the site is live?

I too had same issue/challenge for some months until recently I sorted it out. I have search in the web through Google to fix this issue but with meager success. Because most of them are citing online servers and not local servers - XAMPP in this case.

So, this is what I did to get my XAMPP working with the aforementioned settings causing issues for Menu system as well as Memory Limit on most PHP programmed websites. But for now, we are dealing with Max Input variable limit . So, they are as follows:

  1. Go to your XAMPP folder > PHP Folder
  2. In there look for 3 files: "php.ini", "php.ini-development", and "php.ini-production"
  3. Open each files using any editor of your choice, for me is, Notepad++ and look or search for: max_input_vars = 1000 and increase it to whatever choice number, in my case "5000". Whatever thing you do on php.ini , do same on the other two files mentioned above. Now notice on "php.ini-development", and "php.ini-production" the max_input_vars = 1000 are commented. Uncomment it by removing the " ; " before max_input_vars = "your-new-number" . Now save all of them.

  4. If your XAMPP was running when your were doing all these changes, stop and restart it. Done! You are good to go.

These worked for me, I hope it will for you too and others who had this issues with their XAMPP local server. I want to assume it will also work for WAMP too.

Thanks and regards

PS: My XAMPP version is XAMPP 1.8.2 [PHP: 5.4.27]

For me such way was not works, at least on Linux, there was empty /lamp/php directory.

As superuser, find location of php.ini in your XAMPP directory (for me it was /opt/lamp/etc). Open php.ini file and after ;php.ini Options (or somewhere else, upper is better)

Add such line:

max_input_vars = (that value, what you need).

Then save file and "Restart All" XAMPP server. It works for 5.6.19-0 XAMPP version.

Try this in you .htaccess file:

php_value max_input_vars 2000

Or add this function in php code:

ini_set('max_input_vars', 2000);

I placed it in .htaccess file: but I noticed that the after sometime php_value max_input_vars 2000 was removed by-itself.


Also, in which php code I need to place "ini_set('max_input_vars', 2000);?

in function.php, config.php, or php.ini

Its should be enough with ending php.ini file

; How many GET/POST/COOKIE input variables may be accepted max_input_vars = 10000

The chosen answer is not a recommended approach nor the best practice as is correctly pointed out by its commenters as well as the .htaccess file documentation itself:

The directives (lines) between "BEGIN WordPress" and "END WordPress" are dynamically generated, and should only be modified via WordPress filters. Any changes to the directives between these markers will be overwritten.

As the asker correctly indicated, the php.ini file in XAMPP is located in the xampp\\php directory.

There is also a way to access and edit the underlying php.ini file from the XAMPP's interface by hitting the Apache server's Config button and then choosing php.ini menu:

在此处输入图片说明

Once the php.ini file opens up:

Search in there for the following stanza:

; How many GET/POST/COOKIE input variables may be accepted
; max_input_vars = 1000

Uncomment the max_input_vars variable and change it to the desired value, ie:

; How many GET/POST/COOKIE input variables may be accepted
  max_input_vars = 2000

Restart the Apache server.

Modifying it in this manner will result in the above system configs update properly reflected in the WP dashboard:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM