Laravel错误:在/var/www/html/bootstrap/compiled.php:5289

时间:2014-05-15 16:20:16

标签: laravel

我遇到了与此处相同的问题:Symfony\Component\HttpKernel\Exception\NotFoundHttpException Laravel

然而,我想我在错误的区域问我的问题因此是新的帖子。

我经常收到此错误(但网站似乎表现不错)。下面是我的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}

我的.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>

我的vhost文件:

<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>

编辑:我的主机文件包含以下行:

127.0.0.1 domain.com
127.0.0.1 www.domain.com

我似乎无法弄清楚如何解决这个问题...我错过了什么?

1 个答案:

答案 0 :(得分:0)

对于有此错误的其他人,我认为我已经找到了解决方案。

我有一个相当激进的错误处理程序,它会在抛出任何异常时向我发送电子邮件:

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

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

经过一番挖掘后,我决定添加以下内容:

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

在我看来,根据日志,每次我收到上面提到的令人困惑的错误Laravel error: at /var/www/html/bootstrap/compiled.php : 5289时,就会发生404错误。所以我添加了额外的逻辑,如果代码是404错误,则不向我发送电子邮件异常。现在,我不再收到有关“错误”的大量电子邮件。事实上,它只是一个404 Page Not Found错误而且没有什么可担心的,而且我的应用程序中有一个我需要修复的错误&#34;问题。只是Laravel啰嗦的说法没有找到该页面。