php.ini设置Max Input Vars和WordPress allowed memory size

Wayne Shen

Increasing Max Input Vars

Increasing Max Input Vars in .htaccess File

It’s possible to increase it from .htaccess file in root WordPress installation’s directory. For this you need connect to your server via FTP (using some FTP client like FileZilla), find .htaccess file in the root of your site directory (or create it yourself if it’s missing) and add below lines of codes at the end of the .htaccess file:

php_value max_input_vars 3000
php_value suhosin.get.max_vars 3000
php_value 3000
php_value suhosin.request.max_vars 3000

Increasing Max Input Vars in php.ini File

For this scenario you should also connect via FTP or log in to the CPanel of your hosting provider.

At the end of the php.ini file, add below lines of codes. The php.ini file can be found in /user/local/bin/, /etc/php5/ or … depending on the host provider. If you can not find it, it’s better contact your hosting provider. On some hosting providers, you can create a php.ini file in the root directory and just add the following codes to override the default values.

max_input_vars = 3000
suhosin.get.max_vars = 3000 = 3000
suhosin.request.max_vars = 3000

Increase the WordPress allowed memory size

To increase the WordPress allowed memory size for your website:

  1. Open wp-config.php, which by default is located in the root WordPress directory.
  2. Find the following line near the end of the file:
  3. /* That’s all, stop editing! Happy blogging. */
  4. Just above that line, add the following line:
  5. define(‘WP_MEMORY_LIMIT’, ’96M’);

Save your changes.

You can also increase memory to a higher number, and you can also increase the memory limit for admin tasks, as described in the WordPress codex.

If you’re still receiving the error after this fix, contact your web host provider or server administrator for their help.