Empty @_GET variable = how to change max variable length?

JmsCrk

Registered
May 6, 2011
4
0
51
We're using a php script that has a very long $_GET variable that includes some JSON.

On our test server it works fine, but the same code on the whm / cpanel server produces an empty get variable.

After literally hours of searching the internet and much trial and error it appears that it is simply the length of the queries that causes the $_GET to be entirely empty if it is too long.

It is imperative that this works but I have no idea where the setting would be. I assume it is an apache thing rather than PHP?

How can I change the max query string length? Either using WHM or directly on the server?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
What OS is your test server using? I'm asking this as it might be OS dependent. It is certainly browser dependent based on the online discussions about it. The best information I've found so far is the following:

WWW FAQs: What is the maximum length of a URL?

What is the PHP handler that is being used on the machine? You can get this from WHM > Apache Configuration > PHP and SuExec Configuration area.
 

JmsCrk

Registered
May 6, 2011
4
0
51
Hi Tristan,

Thanks for your help!

We've checked in various browsers and they all work on the test server but not on the live cpanel server, so it can't be a browser problem in this case.

Also, there are no errors in the apache log which is one of the reasons I found this so hard to identify.

The server having the issue is running Centos 5 with WHM / cPanel, PHP version is 5.2.15

Default PHP Version (.php files) 5
PHP 5 Handler suphp
PHP 4 Handler none
Apache suEXEC on


The test server is running Debian so I guess it is possible that it is an OS issue but I hope not...
 

JmsCrk

Registered
May 6, 2011
4
0
51
[solved] Re: Empty $_GET variable = how to change max variable length?

It was suhosin that was limiting the variable length.

I added
PHP:
suhosin.get.max_value_length = 5000
to a php.ini file in the root of the web folder and it fixed it.
 

JmsCrk

Registered
May 6, 2011
4
0
51
Wait - this did not fix it, I was wrong.

Now when I view phpinfo it doesn't show anything about suhosin at all. Before there was a section for it.

I can't see any suhosin errors in the apache log at /usr/local/apache/logs/error_log - is this where suhosin errors should get logged?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
You may see some errors in the suphp_log file as well as the error_log file at /usr/local/apache/logs location.