18

I have Ubuntu 10.10 with apache2, php 5.3.3-1 and mysql 5.1.

I am passing some values to a page via URL. On that page, if I do print_r($_GET), then I see the array contents. But if I do print_r($_REQUEST) the array is empty. Any ideas why this could be?

3
  • This is an old problem... Have you tried var_dump($GLOBALS['_REQUEST']);?
    – Wh1T3h4Ck5
    Apr 18, 2011 at 10:38
  • 2
    yes $GLOBALS['_REQUEST'] is empty too
    – Hawkseye
    Apr 18, 2011 at 10:48
  • Check out register_long_arrays and auto_globals_jit in php.ini. Sometimes it works, when you turn off both of them (restart server after changing php.ini). What values you have there? Also take a look of the @PaulP's answer bellow.
    – Wh1T3h4Ck5
    Apr 18, 2011 at 10:52

2 Answers 2

14

Also try check "request_order" option in php.ini:

This directive determines which super global data (G,P,C,E & S) should be registered into the super global array REQUEST. If so, it also determines the order in which that data is registered. The values for this directive are specified in the same manner as the variables_order directive, EXCEPT one. Leaving this value empty will cause PHP to use the value set in the variables_order directive. It does not mean it will leave the super globals array REQUEST empty.

Default Value: None

Development Value: "GP"

Production Value: "GP"

http://php.net/request-order

request_order = "GP"
3
  • Added link to the PHP man page. You beat me to it so I removed my answer! :)
    – Treffynnon
    Apr 18, 2011 at 10:44
  • 1
    thanks the issue is resolved. the value was empty in php.ini but the funny thing is that i have the same settings on my server but over there it works. request_order no value and variables_order EGPCS. Thanks again tough.
    – Hawkseye
    Apr 18, 2011 at 10:59
  • 2
    Hi PaulP, I have the same problem with Hawkseye, but i found in my php.ini file the request_order is already set to "GP" and also the variables_order is set to "GPCS". I didn't do any changes. I restarted the PHP server but still doesn't work. I'm using nginx 1.4.4 with PHP 5.5.8 for windows. Thanks. Feb 7, 2014 at 4:26
2

if your post body larger than post_max_size or upload_max_filesize which in the php.ini may be cause $_POST and $_REQUEST empty too.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.