2013-03-11 44 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);在脚本的顶部。

相关问题