48

I've just installed Lumen on Windows and unfortunately I'm getting the following error:

NotFoundHttpException in Application.php line 1093:

in Application.php line 1093
at Application->handleDispatcherResponse(array('0')) in Application.php line 1063
at Application->dispatch(null) in Application.php line 1006
at Application->run() in index.php line 28

What may be the problem here?

krisanalfa
  • 6,268
  • 2
  • 29
  • 38
Timo Güntner
  • 2,863
  • 4
  • 17
  • 24

2 Answers2

70

The problem was solved by changing the

$app->run();

in /public/index.php to

$request = Illuminate\Http\Request::capture();
$app->run($request);
Timo Güntner
  • 2,863
  • 4
  • 17
  • 24
  • This really answered my question... Nice – Paul Okeke Apr 24 '15 at 15:54
  • save the day, this should apply on fresh copy, bcz fresh copy only contain `$app->run();` – Safoor Safdar Apr 29 '15 at 15:14
  • 1
    why we need to add the http/request? API will work fine with these lines? – Safoor Safdar Apr 29 '15 at 15:18
  • 6
    @SafoorSafdar If you put your Lumen App inside a subfolder (relative to your web server), Lumen will fail because the `getPathInfo` method return wrong path. If you want to use real `getPathInfo`, you should add extra arguments in `run()` method. See [here](https://github.com/laravel/lumen-framework/blob/5.0/src/Application.php#L1077) and [here](https://github.com/laravel/lumen-framework/blob/5.0/src/Application.php#L1359). – krisanalfa Jun 14 '15 at 10:28
  • 7
    Laravel is great, but sometimes it's very annoying how irrationally stubborn Taylor can be about things such as the sub-folder deal, even when it requires essentially no effort on his end. Also, doing this is officially not supported, and may stop working if the API changes. – Jake Z Sep 02 '15 at 21:10
  • Really helped me on IIS7. Thanks a lot. – delmi Apr 09 '16 at 15:33
65

On your index.php file. Change this line

$app->run();

Into:

$app->run($app->request);

Update

Using make method is faster than accessing class alias via array access.

This one also works:

$app->run(
    $app->make('request')
);
krisanalfa
  • 6,268
  • 2
  • 29
  • 38
  • 2
    @DanielFaria Because [`run`](https://github.com/laravel/lumen-framework/blob/5.0/src/Application.php#L1035) method takes one argument, which can be `null`. Then, application will `dispatch` the route via [`dispatch`](https://github.com/laravel/lumen-framework/blob/5.0/src/Application.php#L1077) method. When the request is null, then request pathInfo will be parsed in [`pathInfo`](https://github.com/laravel/lumen-framework/blob/5.0/src/Application.php#L1359) method. You'll find something interisting here. – krisanalfa Jan 12 '16 at 15:16
  • Worked! Thank you so much! – Tapas Jun 08 '23 at 14:40