{"id":1421,"date":"2013-06-02T19:00:29","date_gmt":"2013-06-03T02:00:29","guid":{"rendered":"http:\/\/www.virendrachandak.com\/techtalk\/\/?p=1421"},"modified":"2013-11-16T11:45:27","modified_gmt":"2013-11-16T19:45:27","slug":"big-forms-and-php-max_input_vars","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/","title":{"rendered":"Big forms and PHP max_input_vars"},"content":{"rendered":"<p>Recently I was working in WordPress to create a big menu, with over 75 links in it. When I created it and tried to save it got save only partially, few menu items at the end got truncated. I was not sure what happened. So then I tried to add 1 more link and it was not saving. Then I decided to check if there were any PHP errors. I found the following in the error logs:<\/p>\n<blockquote><p>PHP Warning:  Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: http:\/\/mysite.com\/wp-admin\/nav-menus.php<\/p><\/blockquote>\n<p>Then I found out that there is a PHP setting &#8220;<strong>max_input_vars<\/strong>&#8221; (available since <a href=\"http:\/\/www.php.net\/ChangeLog-5.php#5.3.9\" rel=\"external nofollow\">PHP 5.3.9<\/a>) which limits the number of variables that PHP will process. If this value is 1000 (default is 1000) PHP will process first 1000 variables and drop the remaining. This was the reason why some menu items were saved and some not.<br \/>\n<!--more--><br \/>\nTo solve this issue we need to increase the &#8220;<strong>max_input_vars<\/strong>&#8221; to a bigger number. I changed it to 2000 and it solved my problem. You might need less or more depending on your requirements. <\/p>\n<p>How can we change this value? There are 2 ways. Either by changing the variable in .htaccess file or php.ini file. I will show how to change it using both the methods. <\/p>\n<p><strong>1. Change max_input_vars using .htaccess file.<\/strong><br \/>\nIf you want to change the &#8220;<strong>max_input_vars<\/strong>&#8221; using .htaccess file then add the following code in you .htaccess file.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nphp_value max_input_vars 2000\r\n<\/pre>\n<p><strong>2. Change max_input_vars using php.ini file<\/strong><br \/>\n<strong>Note<\/strong>: If you make any error in your php.ini file you site may not function properly. So make sure you know how to change it, else have someone who can do this change.<\/p>\n<p>Edit your php.ini file and search for &#8220;<strong>max_input_vars<\/strong>&#8220;. this might look something similar to following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n; max_input_vars = 1000\r\n<\/pre>\n<p>The above line is commented, that means it will take PHP&#8217;s default value which is 1000. To change it to 2000 change that line to be:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmax_input_vars = 2000\r\n<\/pre>\n<p>After this change you will have to restart your apache.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I was working in WordPress to create a big menu, with over 75 links in it. When I created it and tried to save it got save only partially, few menu items at the end got truncated. I was not sure what happened. So then I tried to add 1 more link and it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[143,6],"tags":[119],"class_list":["post-1421","post","type-post","status-publish","format-standard","hentry","category-php","category-server-configuration","tag-max_input_vars"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Big forms and PHP max_input_vars - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"Since PHP 5.3.9 there is new PHP setting max_input_vars, which limits the number of variables that PHP will process. By default this is 1000 variables.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Big forms and PHP max_input_vars - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"Since PHP 5.3.9 there is new PHP setting max_input_vars, which limits the number of variables that PHP will process. By default this is 1000 variables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2013-06-03T02:00:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-11-16T19:45:27+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"Big forms and PHP max_input_vars\",\"datePublished\":\"2013-06-03T02:00:29+00:00\",\"dateModified\":\"2013-11-16T19:45:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/\"},\"wordCount\":377,\"commentCount\":17,\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"max_input_vars\"],\"articleSection\":[\"PHP\",\"Server Configuration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/\",\"name\":\"Big forms and PHP max_input_vars - Virendra&#039;s TechTalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\"},\"datePublished\":\"2013-06-03T02:00:29+00:00\",\"dateModified\":\"2013-11-16T19:45:27+00:00\",\"description\":\"Since PHP 5.3.9 there is new PHP setting max_input_vars, which limits the number of variables that PHP will process. By default this is 1000 variables.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/big-forms-and-php-max_input_vars\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/category\\\/php\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Big forms and PHP max_input_vars\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.virendrachandak.com\",\"https:\\\/\\\/www.facebook.com\\\/virendrachandak\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/virendrachandak\\\/\",\"https:\\\/\\\/x.com\\\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Big forms and PHP max_input_vars - Virendra&#039;s TechTalk","description":"Since PHP 5.3.9 there is new PHP setting max_input_vars, which limits the number of variables that PHP will process. By default this is 1000 variables.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/","og_locale":"en_US","og_type":"article","og_title":"Big forms and PHP max_input_vars - Virendra&#039;s TechTalk","og_description":"Since PHP 5.3.9 there is new PHP setting max_input_vars, which limits the number of variables that PHP will process. By default this is 1000 variables.","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2013-06-03T02:00:29+00:00","article_modified_time":"2013-11-16T19:45:27+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"Big forms and PHP max_input_vars","datePublished":"2013-06-03T02:00:29+00:00","dateModified":"2013-11-16T19:45:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/"},"wordCount":377,"commentCount":17,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["max_input_vars"],"articleSection":["PHP","Server Configuration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/","name":"Big forms and PHP max_input_vars - Virendra&#039;s TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2013-06-03T02:00:29+00:00","dateModified":"2013-11-16T19:45:27+00:00","description":"Since PHP 5.3.9 there is new PHP setting max_input_vars, which limits the number of variables that PHP will process. By default this is 1000 variables.","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/big-forms-and-php-max_input_vars\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"PHP","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},{"@type":"ListItem","position":3,"name":"Big forms and PHP max_input_vars"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-mV","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=1421"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1421\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=1421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=1421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=1421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}