Home >Backend Development >PHP Tutorial >What's the Maximum URL Parameter Length in PHP's `_GET` and How Can I Increase It?
In PHP, RESTful APIs often rely on URL parameters in the _GET global to pass data to the server. However, some users may encounter an issue where a specific URL parameter fails to appear in _GET after reaching a certain cutoff length.
This limitation, as noted in PHP documentation, is imposed by the suhosin patch installed on certain PHP configurations. By default, suhosin restricts GET parameter length to 512 characters. While this is generally considered bad practice, browsers typically support URLs up to 2000 characters, and Apache has a default limit of 8000 characters.
To resolve this issue and extend the maximum length of GET parameters, users can adjust the suhosin configuration by adding the following line to php.ini:
suhosin.get.max_value_length = <limit>
By setting the desired limit, you can increase the size of URL parameters allowed in _GET and eliminate the cutoff issue. This solution is particularly beneficial when working with large data sets that require longer parameter strings.
The above is the detailed content of What's the Maximum URL Parameter Length in PHP's `_GET` and How Can I Increase It?. For more information, please follow other related articles on the PHP Chinese website!