Php unknown input variables exceeded 1000

how to increase limit change in php.ini?

I am using phpmyadmin on my computer and while I tried to update my data, the following happens » Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 «. I tried to search » php.ini » on my computer, but I can’t find it anywhere. Does this mean I have to create one by myself? If so, where should I put the file? I am not exactly sure what to do. Thank you very much.

  • 3 Contributors
  • 11 Replies
  • 11K Views
  • 1 Day Discussion Span
  • Latest Post 10 Years Ago Latest Post by jeffadrian

Hi,

copy, paste to notepad, save as whateverfile.php, and direct your browser to this file.

Look for the value of this

Loaded Configuration File 

Using your windows explorer and locate the php.ini file as shown on your Loaded Configuration …

I forgot to tell you that you will need to restart the apache server.

To help you out more, this is how the default setting would look like

;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;; ; Maximum execution time of each script, in seconds ; Jump to Post

All 11 Replies

Loaded Configuration File 

Using your windows explorer and locate the php.ini file as shown on your Loaded Configuration File . Change the values of the following

post_max_size upload_max_filesize 

it is ok to give it a higher value like 200M. last thing, change this value to a higher value as needed by your php applications..

I am able to find this » php.ini » file on my computer Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 I did change the value of max_input_vars, but it’s still not working. What’s the value that I should change to?

To answer your last question, you can either increase it to or higher. It is your call. Don’t forget to restart the apache.

;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;; ; Maximum execution time of each script, in seconds ; ' data-bs-template=' '>http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 30 ; Maximum amount of time each script may spend parsing request data. It's a good ; idea to limit this time on productions servers in order to eliminate unexpectedly ; long running scripts. ; Note: This directive is hardcoded to -1 for the CLI SAPI ; Default Value: -1 (Unlimited) ; Development Value: 60 (60 seconds) ; Production Value: 60 (60 seconds) ; ' data-bs-template=' '>http://php.net/max-input-time max_input_time = 60 ; Maximum input variable nesting level ; ' data-bs-template=' '>http://php.net/max-input-nesting-level ;max_input_nesting_level = 64 ; How many GET/POST/COOKIE input variables may be accepted ; max_input_vars = 1000 ; Maximum amount of memory a script may consume (128MB) ; ' data-bs-template=' '>http://php.net/memory-limit memory_limit = 128M 

Dude, It can’t be the same result if you are following my first response, Where it says look for the value of the «Loaded Configuration File«.. The value assigned to the loaded configuration file is the location of the php.ini file currently being loaded by the apache server to initialize the PHP support.. that’s simple.. DO NOT EDIT the php.ini file located in the C:\WINDOWSthis is a system php.ini file. Apache needs to at least tell the mother ship what it intends to do.. This-> Loaded Configuration File and NOT this ->** Configuration File (php.ini) Path** Normally, the loaded configuration file is located in the php directory compiled with the apache2..for example

Читайте также:  Sort algorithms in python

I used xampp, so I did change the value in the xampp folder which is » C:\xampp\php\php.ini «. I didn’t change any other place. I restarted apache from the xampp control panel and also restart my computer, but nothing happened I still see this error » Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 «

Источник

PHP Warning: Unknown: Input Variables Exceeded 1000

I found out that the right way to handle json data directly in PHP (via file_get_contents(‘php://input’) ) is to make sure the request sets the right content-type i.e. Content-type: application/json in the HTTP request header.

In my case I’m requesting pages from php using curl with to this code:

function curl_post($url, array $post = NULL, array $options = array()) $defaults = array( 
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 600
);
if(!is_null($post))
$defaults['CURLOPT_POSTFIELDS'] = http_build_query($post);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if(($result = curl_exec($ch)) === false) throw new Exception(curl_error($ch) . "\n $url");
>
if(curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) throw new Exception("Curl error: ".
curl_getinfo($ch, CURLINFO_HTTP_CODE) ."\n".$result . "\n");
>
curl_close($ch);
return $result;
>

$curl_result = curl_post(URL, NULL,
array(CURLOPT_HTTPHEADER => array('Content-Type: application/json'),
CURLOPT_POSTFIELDS => json_encode($out))
);

Do note the CURLOPT_HTTPHEADER => array(‘Content-Type: application/json’) part.

On the receiving side I’m using the following code:

$rawData = file_get_contents('php://input');
$postedJson = json_decode($rawData,true);
if(json_last_error() != JSON_ERROR_NONE) error_log('Last JSON error: '. json_last_error().
json_last_error_msg() . PHP_EOL. PHP_EOL,0);
>

Do not change the max_input_vars variable. Since changing the request to set right headers my issue with max_input_vars went away. Apparently does not PHP evaluate the post variables with certain Content-type is set.

Читайте также:  Python setup py bdist egg

PHP Warning: Unknown: Input variables exceeded 1000

That’s a new setting / value in PHP (related to a security update to prevent attacks to PHP scripts), so you get this after the update (before PHP 5.3.9 not set/available, suhosin users have a similar thing since ages).

Input values are of different kinds and array members count as well. So it’s not enough to count form fields but also to take a look into the URL and other places related to input ( $_GET , $_POST , $_SERVER , $_ENV , $_FILES , $_COOKIE . ).

How many input variables may be accepted. Use of this directive mitigates the possibility of denial of service attacks which use hash collisions. If there are more input variables than specified by this directive, an E_WARNING is issued, and further input variables are truncated from the request. This limit applies only to each nesting level of a multi-dimensional input array.

How to change max_input_vars

ini_set('max_input_vars','2000' );

but this never work with ini_set.
You need to set it with php.ini or .htaccess file only.

php: max_input_vars exceeded 1000

This does not have anything to do with DB record count, rather with what is the data size that you are sending to server.

Following is what manual says:

How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). Use of this directive mitigates the possibility of denial of service attacks which use hash collisions. If there are more input variables than specified by this directive, an E_WARNING is issued, and further input variables are truncated from the request.

If you do not want to update php.ini you can try using .htaccess:

php_value max_input_vars 10000

PHP Warning: Unknown: Input variables exceeded 1000

On some distributions there are multiple php.ini files — one for cli, one for cgi and one for apache (or sapi).

If you use mod_php you might need to change /etc/php5/apache2/php.ini (this path is valid for Debian) and afterwards you must restart the webserver.

Читайте также:  Php soap пример запроса

In order to find out which php.ini was used, you can create a small php script containing and execute it (using the webserver). There you will see which php.ini was used.

How should I track down PHP Warning: Input variables exceeded 1000

If it only happens occassionally and potentially also affects end users it’s actually rather safe to just raise the limit — it’s a limitation imposed for practical reasons to circumvent possible attacks.

Practically, to debug this I’d dive into edge cases. In a real world scenario I’d indeed expect this error to only occur when something is nested indefinitely. I’d insert a small detection script somewhere in code that’s always included, for example:

function detectLargeInputs($name, $array)
if(count($array) > 500)
mail('mymail@domain.tld', 'Large input in '.$name,
print_r($array, true).print_r($_SERVER, true));
>
detectLargeInputs('GET', $_GET);
detectLargeInputs('POST', $_POST);
detectLargeInputs('COOKIE', $_COOKIE);

This should show the problem within a day, including the $_SERVER info that also has fields like REQUEST_URI and HTTP_REFERER which should help you pinpoint the issue exactly.

PHP E_WARNING Input variables exceeded not displayed

display_startup_errors = On
error_reporting = -1
display_errors = On
display_startup_errors = On

sadly you can’t do nothing more than print or not to print it

Источник

[Решено]Не сохраняется страница (node) в Drupal 7 — ошибка «PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini»

Здравствуйте, друзья! Давно не писал в блог, но постараемся изменить ситуацию. Это скорее заметка, но на память лично мне самому может пригодится.

Проблема с сохранением ноды

На одном проекте возникла проблема с сохранением больших нод. Ну как «больших»? Несколько десятков фото, метатеги, redirect и прочие стандартные поля. Но тем не менее при сохранении нода снималась с публикации и обратно ее можно было включить только через раздел «Содержимое» — /admin/content В логах ошибка (домен и id ноды изменены): [Thu Feb 19 15:28:30 2015] [error] [client 37.147.83.83] 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://site.ru/node/1111/edit

Решение проблемы

Собственно решение кроется в ошибке из лога: нужно увеличить max_input_vars в настройках php.ini. Если у вас есть полный доступ к этим настройкам, то смело увеличьте лимит и забудьте об этой беде!

Решение для шареда — htaccess

Если же у вас арендованный хостинг, так называемый шаред, то исправить проблему можно с помощью htaccess в корне вашего друпальчика. Дописываем в конце нужные настройки: php_value max_input_vars 6000 php_value suhosin.post.max_vars 6000 php_value suhosin.request.max_vars 6000 При обновлении ядра не забывайте про внесенные изменения в этот файлик) Удачи!

Источник

Оцените статью