I am accessing a PHP server using REST: all data is passed in a GET request as URL parameters. One of the parameters arrives at the server in the query_string, but it is not in the _GET global. But shortening the parameter (the cutoff seems to be around 512 characters) lets it through.
我使用REST访问PHP服务器:所有数据都作为URL参数在GET请求中传递。其中一个参数在query_string中到达服务器,但它不在_GET全局中。但缩短参数(截止值似乎约为512个字符)让它通过。
Assuming I have diagnosed the problem correctly, is there a way to change this maximum size? I have not found any explanation in the documentation, not even a mention of this limit. This is on Debian squeeze / Apache 2.2.16 / PHP 5.3.3.
假设我已正确诊断出问题,有没有办法改变这个最大尺寸?我没有在文档中找到任何解释,甚至没有提到这个限制。这是在Debian squeeze / Apache 2.2.16 / PHP 5.3.3上。
2 个解决方案
#1
66
Ok, it seems that some versions of PHP have a limitation of length of GET params:
好吧,似乎某些版本的PHP具有GET参数长度的限制:
Please note that PHP setups with the suhosin patch installed will have a default limit of 512 characters for get parameters. Although bad practice, most browsers (including IE) supports URLs up to around 2000 characters, while Apache has a default of 8000.
请注意,安装了suhosin补丁的PHP设置对于get参数的默认限制为512个字符。虽然不好的做法,但大多数浏览器(包括IE)支持最多约2000个字符的URL,而Apache的默认值为8000。
To add support for long parameters with suhosin, add
suhosin.get.max_value_length = <limit>
inphp.ini
要使用suhosin添加对长参数的支持,请在php.ini中添加suhosin.get.max_value_length =
Source: http://www.php.net/manual/en/reserved.variables.get.php#101469
资料来源:http://www.php.net/manual/en/reserved.variables.get.php#101469
#2
0
See What is the maximum length of a URL in different browsers?
请参阅不同浏览器中URL的最大长度是多少?
The length of the url can't be changed in PHP. The linked question is about the URL size limit, you will find what you want.
在PHP中无法更改URL的长度。链接的问题是关于URL大小限制,您将找到您想要的。
#1
66
Ok, it seems that some versions of PHP have a limitation of length of GET params:
好吧,似乎某些版本的PHP具有GET参数长度的限制:
Please note that PHP setups with the suhosin patch installed will have a default limit of 512 characters for get parameters. Although bad practice, most browsers (including IE) supports URLs up to around 2000 characters, while Apache has a default of 8000.
请注意,安装了suhosin补丁的PHP设置对于get参数的默认限制为512个字符。虽然不好的做法,但大多数浏览器(包括IE)支持最多约2000个字符的URL,而Apache的默认值为8000。
To add support for long parameters with suhosin, add
suhosin.get.max_value_length = <limit>
inphp.ini
要使用suhosin添加对长参数的支持,请在php.ini中添加suhosin.get.max_value_length =
Source: http://www.php.net/manual/en/reserved.variables.get.php#101469
资料来源:http://www.php.net/manual/en/reserved.variables.get.php#101469
#2
0
See What is the maximum length of a URL in different browsers?
请参阅不同浏览器中URL的最大长度是多少?
The length of the url can't be changed in PHP. The linked question is about the URL size limit, you will find what you want.
在PHP中无法更改URL的长度。链接的问题是关于URL大小限制,您将找到您想要的。