查询在PgAdmin中工作,但在CakePHP中不工作

查询在PgAdmin中工作,但在CakePHP中不工作,php,cakephp,timeout,Php,Cakephp,Timeout,我有这个查询(PostgreSQL): 它可以在PgAdmin、EMS客户端、Navicat、Postgres命令行中工作。 我在两个版本的Postgres数据库中测试此查询: 8.2:19秒 9.2:16ms 但是不能在CakePHP中使用$this->query($sql):2013-03-11 17:59:48错误:[FatalErrorException]超出了30秒的最大执行时间 CakePHP是否以不同的方式执行/运行此查询? #8 .......................

我有这个查询(PostgreSQL):

它可以在PgAdmin、EMS客户端、Navicat、Postgres命令行中工作。 我在两个版本的Postgres数据库中测试此查询:

  • 8.2:19秒
  • 9.2:16ms
但是不能在CakePHP中使用
$this->query($sql):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}
为什么?


我正在使用:

  • CakePHP2.3.0
  • PostgreSQL 9.2
  • PHP 5.3.9
  • Apache2.2
  • Windows 7 x64

默认情况下,PHP脚本的最大执行时间为30秒。运行此SQL时,返回和处理数据的时间大于30秒。您需要增加最大执行时间或优化查询。
尝试设置时间限制(0);在您的脚本顶部。

我们无法使用“不起作用”。请给我们一条错误消息。细节越多越好。现在我添加了更多的细节显示查询在其他环境中需要多长时间?在Postgres 8.2=19s/在9.2=16ms中。您确定这不是从数据库查询返回并且在php中处理结果需要很长时间的情况吗?我不是php程序员,但google告诉我可以更改脚本的最大执行时间。