0

I was having the same issue as seen here: Symfony\Component\HttpKernel\Exception\NotFoundHttpException Laravel

However, I guess I was asking my question in the wrong area hence the new post.

I am getting this error constantly (but the site seems to perform fine). Below is my stacktrace:

#0 /var/www/html/bootstrap/compiled.php(4663): Illuminate\Routing\RouteCollection->match(Object(Illuminate\Http\Request))
#1 /var/www/html/bootstrap/compiled.php(4651): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
#2 /var/www/html/bootstrap/compiled.php(4643): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#3 /var/www/html/bootstrap/compiled.php(698): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#4 /var/www/html/bootstrap/compiled.php(679): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#5 /var/www/html/bootstrap/compiled.php(1136): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#6 /var/www/html/bootstrap/compiled.php(7218): Illuminate\Http\FrameGuard->handle(Object(Illuminate\Http\Request), 1, true)
#7 /var/www/html/bootstrap/compiled.php(7815): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#8 /var/www/html/bootstrap/compiled.php(7762): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#9 /var/www/html/bootstrap/compiled.php(10768): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#10 /var/www/html/bootstrap/compiled.php(640): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#11 /var/www/html/public/index.php(49): Illuminate\Foundation\Application->run()
#12 {main}

My .htaccess:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect www to non-www
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

My vhost file:

<VirtualHost *:80>

    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/html/public

    <Directory "/var/www/html/public">
        Options Includes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:443>

    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/html/public

    <Directory "/var/www/html/public">
        Options Includes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    SSLEngine ON
    SSLCertificateFile /root/domain.com.ssl/domain.com.crt
    SSLCertificateKeyFile /root/domain.com.ssl/domain.com.key
    SSLCACertificateFile /root/domain.com.ssl/domain.com.ca_bundle.crt

</VirtualHost>

Edit: My hosts files has the following lines:

127.0.0.1 domain.com
127.0.0.1 www.domain.com

I can't seem to figure out how to fix this issue...am I missing something?

3
  • Is this a new install? Did you just update composer? Commented May 15, 2014 at 16:24
  • Delete the file /var/www/html/bootstrap/compiled.php, try again and replace your error log with the new one. Commented May 15, 2014 at 16:59
  • Not a new install. I have deleted the compiled.php and run php artisan optimize, which generates it again as this is a production environment (debug=false). Also, cleared my error log. Same issue. Commented May 16, 2014 at 17:30

1 Answer 1

0

OK for anyone else who has this error I think I've found the solution.

I had a fairly aggressive error handler which sent me emails on any exceptions thrown:

App::error(function(Exception $exception, $code)
{
    Log::error($exception);

    // Additional code to email me detailed report on any exception thrown
    ...
}

After some digging around I decided to add the following:

$this->app->missing(function($exception)
{
    $url = Request::fullUrl();
    Log::warning("404 for URL: $url");
});

It appears to me, based on the logs, that each time I was getting the confusing error mentioned above Laravel error: at /var/www/html/bootstrap/compiled.php : 5289, that a 404 error went along with it. So I added additional logic to NOT email me the exception if the code is a 404 error. Now, I no longer get numerous emails regarding the 'error' when in fact, it's simply a 404 Page not Found error and nothing to be concerned with as far as "OMG there is an error in my application that I need to fix" issue. It's just Laravel's long-winded way of saying the page was not found.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.