我有这个查询(PostgreSQL):https://gist.github.com/patrickmaciel/74c72cdf1984bdcde804
它适用于PgAdmin,EMS客户端,Navicat,Postgres命令行等等。 我在2个版本的Postgres数据库中测试了这个查询:
但是在带有$this->query($sql);
的CakePHP中不起作用: 2013-03-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}
为什么?
我正在使用:
答案 0 :(得分:2)
默认情况下,PHP脚本的最长执行时间为30秒。运行此SQL时,返回和处理数据的时间大于30秒。您需要增加最长执行时间或优化查询。 尝试set_time_limit(0);在脚本的顶部。