2013-03-11 42 views
1

我有這個疑問(PostgreSQL的):https://gist.github.com/patrickmaciel/74c72cdf1984bdcde804查詢工作在pgAdmin的但不是在CakePHP的

它的作品在pgAdmin的,EMS客戶端,Navicat的,Postgres的命令行,等等。

  • 8.2:19S
  • 9.2: 我在2個版本的Postgres數據庫的測試此查詢16ms的

但在CakePHP中與$this->query($sql);不起作用:2013年3月11日17 :59:48錯誤:[FatalErrorException]超過最大執行時間30秒時

CakePHP以不同的方式執行/運行此查詢嗎?

#8 ...........................\app\Controller\Component\CommonCheckComponent.php(64): CommonCheckComponent->validateCheckPromotion(Array, Array, NULL) 
#9 ...........................\app\Controller\Component\CommonCheckComponent.php(40): CommonCheckComponent->applyCheckPromotion(Array, Array) 
#10 ...........................\app\Controller\Component\CommonTableComponent.php(56): CommonCheckComponent->insertDefaultPromotions(Array) 
#11 ...........................\app\Controller\ChecksController.php(42): CommonTableComponent->putTableInCheck(Array, '374') 
#12 [internal function]: ChecksController->printCheck('28') 
#13 ...........................\lib\Cake\Controller\Controller.php(486): ReflectionMethod->invokeArgs(Object(ChecksController), Array) 
#14 ...........................\lib\Cake\Routing\Dispatcher.php(187): Controller->invokeAction(Object(CakeRequest)) 
#15 ...........................\lib\Cake\Routing\Dispatcher.php(162): Dispatcher->_invoke(Object(ChecksController), Object(CakeRequest), Object(CakeResponse)) 
#16 ...........................\app\webroot\index.php(109): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse)) 
#17 {main} 
2013-03-11 17:59:48 Error: Fatal Error (1): Maximum execution time of 30 seconds exceeded in [...........................\lib\Cake\Model\Datasource\DboSource.ph 
p, line 460] 
2013-03-11 17:59:48 Error: [FatalErrorException] Maximum execution time of 30 seconds exceeded 
Request URL: /patrick/chima-rms/chimarms/checks/printCheck/28 
Stack Trace: 
#0 ...........................\lib\Cake\Error\ErrorHandler.php(184): ErrorHandler::handleFatalError(1, 'Maximum executi...', 'C:\www\patrick\...', 460) 
#1 [internal function]: ErrorHandler::handleError(1, 'Maximum executi...', 'C:\www\patrick\...', 460, Array) 
#2 ...........................\lib\Cake\Core\App.php(927): call_user_func('ErrorHandler::h...', 1, 'Maximum executi...', 'C:\www\patrick\...', 460, Array) 
#3 ...........................\lib\Cake\Core\App.php(900): App::_checkFatalError() 
#4 [internal function]: App::shutdown() 
#5 {main} 
2013-03-11 17:59:49 Error: Fatal Error (1): Maximum execution time of 30 seconds exceeded in [...........................\lib\Cake\Model\Datasource\CakeSession. 
php, line 616] 
2013-03-11 17:59:49 Error: [FatalErrorException] Maximum execution time of 30 seconds exceeded 
Request URL: /patrick/chima-rms/chimarms/checks/printCheck/28 
Stack Trace: 
#0 ...........................\lib\Cake\Error\ErrorHandler.php(184): ErrorHandler::handleFatalError(1, 'Maximum executi...', 'C:\www\patrick\...', 616) 
#1 [internal function]: ErrorHandler::handleError(1, 'Maximum executi...', 'C:\www\patrick\...', 616, Array) 
#2 ...........................\lib\Cake\Core\App.php(927): call_user_func('ErrorHandler::h...', 1, 'Maximum executi...', 'C:\www\patrick\...', 616, Array) 
#3 ...........................\lib\Cake\Core\App.php(900): App::_checkFatalError() 
#4 [internal function]: App::shutdown() 
#5 {main} 
2013-03-11 18:00:11 Error: Fatal Error (1): Maximum execution time of 30 seconds exceeded in [...........................\lib\Cake\Utility\Debugger.php, line 47 
3] 
2013-03-11 18:00:11 Error: [FatalErrorException] Maximum execution time of 30 seconds exceeded 
Request URL: /patrick/chima-rms/chimarms/checks/printCheck/28 
Stack Trace: 
#0 ...........................\lib\Cake\Error\ErrorHandler.php(184): ErrorHandler::handleFatalError(1, 'Maximum executi...', 'C:\www\patrick\...', 473) 
#1 [internal function]: ErrorHandler::handleError(1, 'Maximum executi...', 'C:\www\patrick\...', 473, Array) 
#2 ...........................\lib\Cake\Core\App.php(927): call_user_func('ErrorHandler::h...', 1, 'Maximum executi...', 'C:\www\patrick\...', 473, Array) 
#3 ...........................\lib\Cake\Core\App.php(900): App::_checkFatalError() 
#4 [internal function]: App::shutdown() 
#5 {main} 

爲什麼?


我使用:

  • CakePHP的2.3.0
  • 的PostgreSQL 9.2
  • PHP 5.3.9
  • Apache 2.2的
  • Windows 7的64位
+0

我們不能用「不行」做很多事情。給我們一個錯誤信息。越詳細越好。 – digitaljoel 2013-03-11 21:37:03

+0

現在我添加更多詳細信息 – 2013-03-11 21:40:39

+0

查詢在其他環境中花了多長時間? – digitaljoel 2013-03-11 21:46:26

回答

2

默認情況下, PHP腳本的執行時間是30s。運行此SQL時,返回和處理數據的時間大於30秒。您需要增加最大執行時間或優化查詢。 嘗試set_time_limit(0);在腳本的頂部。

相關問題