2016-04-24 56 views
0

我有本地開發環境設置與xampp,並與工作laravel 5.2和php5.6.3。 使路由請求沒有數據庫操作運行沒有任何問題,但在數據庫操作的執行試圖訪問與雄辯的模型結果的分貝php對數據庫調用的每個laravel請求的執行超時

Maximum execution time of 60 seconds exceeded 

在不同的點。 這是錯誤日誌

[2016-04-25 02:57:56] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum execution time of 60 seconds exceeded' in C:\xampp\htdocs\pscosmetics\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:539 
Stack trace: 
#0 {main} 
[2016-04-25 03:05:57] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum execution time of 60 seconds exceeded' in C:\xampp\htdocs\pscosmetics\vendor\laravel\framework\src\Illuminate\Support\Str.php:89 
Stack trace: 
#0 {main} 
[2016-04-25 03:08:51] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum execution time of 60 seconds exceeded' in C:\xampp\htdocs\pscosmetics\vendor\laravel\framework\src\Illuminate\Database\Query\Grammars\Grammar.php:834 
Stack trace: 
#0 {main} 
[2016-04-25 03:11:04] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum execution time of 60 seconds exceeded' in C:\xampp\htdocs\pscosmetics\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:539 
Stack trace: 
#0 {main} 
[2016-04-25 03:35:59] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum execution time of 60 seconds exceeded' in C:\xampp\htdocs\pscosmetics\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\Relation.php:204 
Stack trace: 
#0 {main} 
[2016-04-25 03:40:42] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum execution time of 60 seconds exceeded' in C:\xampp\htdocs\pscosmetics\vendor\laravel\framework\src\Illuminate\Database\Query\Grammars\Grammar.php:834 
Stack trace: 
#0 {main} 


Trying the same db operation using vanilla php and PDO works without a hitch, phpMyadmin works ok. 
What could cause this sort of issue?. 
+0

什麼調用是你的腳本準確超時? – Chris

+0

@Chris數據庫調用...我用錯誤日誌更新了這個問題 – MrFoh

+0

@MrFoh請發佈調用db的控制器? –

回答

0

後左右誤差堆棧跟蹤挖掘的時間,我想通了,問題是用雄辯的立即加載。

<?php 

namespace App\Entities; 

use Illuminate\Database\Eloquent\Model; 

class Category extends Model { 

    protected $fillable = ['parent_id', 'name', 'slug', 'description', 'keywords']; 

    /** 
    This is what was causing the timeouts as it had it's own nested relationships 
    */ 
    protected $with = ['products']; 

    public function products() { 
     return $this->hasMany('App\Entities\Product', 'category_id'); 
    } 
}