Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jimbaldwin123's avatar

query strings not passing to controller, anything based on _GET not working

Laravel 5.2.45, Nginx, Ubuntu 16. Anything passed with a query string is null in the controller. Using $request->input(), Input::, _GET, anything based on _GET. E.g., /userlist?page=2, request->input is empty, _GET is empty, etc.

_GET works in a plain PHP file. The same app works on 3 other Ubuntu boxes. I've tried completely deleting the app, reinstalling Laravel, and cloning the app again.

0 likes
12 replies
Snapey's avatar

Are you specifying 'web' middleware in your routes file?

run php artisan route:list and check what middleware is applied to the routes.

jimbaldwin123's avatar
  1. Yes, post works, sessions work, cookies work. I'm not sure what I should look for in that Nginx link, but _GET works in plain old PHP on that same Nginx server, so I don't think it's an Nginx or PHP issue.

  2. Yes, I'm putting it in the web middleware, should have stated that in my question. route:list shows web,admin for the route in question.

Thanks for replying!

Snapey's avatar

you should not be putting web middleware as it is added automatically these days. this would be illustrated by web being listed twice against each route

jimbaldwin123's avatar

I did have web middleware specified at one point but taking it out didn't make any difference -- the same code works on 3 other boxes with the same OS and server.

jlrdw's avatar

Copy this application exactly to one of the other operating systems that work and verify it does work there also.

jimbaldwin123's avatar

It works on 3 other computers with the same OS and server. Deleted the app, reinstalled Laravel, cloned the git repository from another computer where it works.

bastihilger's avatar

I have exactly the same problem on a Forge server (PHP 7.1) - did you find out what the error was?

bastihilger's avatar

Wait - my problem ist not exactly the same, as it seems NO GET parameters get throught at all. I tried catching them right on the first line of public/index.php (empty array, while it shows the parameters on my local machine).

jimbaldwin123's avatar

well it's Nginx, but you're right, it was in the Nginx config file.

ememisaac's avatar

For me the issue was that in my site configuration file in /etc/nginx/sites-available/default

location / { //Bad configuration try_files $uri $uri/ /index.php?$args;

    //Correct configuration
    try_files $uri $uri/ /index.php?$query_string;  

}

Changing $args to $query_string solved the problem

Please or to participate in this conversation.