Database connection "SQLSTATE[HY000] [2002] Connection refused" is missing, or could not be created.
Error:
An Internal Error Has Occurred.
Stack Trace
- CORE/Cake/Model/Datasource/DboSource.php line 260 → Mysql->connect()
));
}
if ($autoConnect) {
$this->connect();
}
- CORE/Cake/Model/ConnectionManager.php line 101 → DboSource->__construct(array)
$conn = self::$_connectionsEnum[$name];
$class = $conn['classname'];
self::$_dataSources[$name] = new $class(self::$config->{$name});
self::$_dataSources[$name]->configKeyName = $name;
array(
'password' => '*****',
'login' => '*****',
'host' => '*****',
'database' => '*****',
'prefix' => '*****',
'datasource' => 'Database/Mysql',
'persistent' => false,
'encoding' => 'utf8'
)
- CORE/Cake/Model/Model.php line 3157 → ConnectionManager::getDataSource(string)
if ($dataSource != null) {
$this->useDbConfig = $dataSource;
}
$db = ConnectionManager::getDataSource($this->useDbConfig);
if (!empty($oldConfig) && isset($db->config['prefix'])) {
- CORE/Cake/Model/Model.php line 1092 → Model->setDataSource(string)
* @return void
*/
public function setSource($tableName) {
$this->setDataSource($this->useDbConfig);
$db = ConnectionManager::getDataSource($this->useDbConfig);
- CORE/Cake/Model/Model.php line 3179 → Model->setSource(string)
public function getDataSource() {
if (!$this->_sourceConfigured && $this->useTable !== false) {
$this->_sourceConfigured = true;
$this->setSource($this->useTable);
}
- CORE/Cake/Model/Model.php line 2630 → Model->getDataSource()
return null;
}
$results = $this->getDataSource()->read($this, $query);
$this->resetAssociations();
- APP/Controller/AppController.php line 44 → Model->find(string, array)
'News.status' => 1,),
'order' => 'News.id DESC',
//'limit' => 2
));
$this->set('news',$news);
'all'
array(
'conditions' => array(
'News.status' => (int) 1
),
'order' => 'News.id DESC'
)
- [internal function] → AppController->beforeFilter(CakeEvent)
object(CakeEvent) {
data => null
result => null
}
- CORE/Cake/Event/CakeEventManager.php line 246 → call_user_func(array, CakeEvent)
if ($listener['passParams'] === true) {
$result = call_user_func_array($listener['callable'], $event->data);
} else {
$result = call_user_func($listener['callable'], $event);
}
array(
(int) 0 => object(ProductController) {},
(int) 1 => 'beforeFilter'
)
object(CakeEvent) {
data => null
result => null
}
- CORE/Cake/Controller/Controller.php line 670 → CakeEventManager->dispatch(CakeEvent)
* @return void
*/
public function startupProcess() {
$this->getEventManager()->dispatch(new CakeEvent('Controller.initialize', $this));
$this->getEventManager()->dispatch(new CakeEvent('Controller.startup', $this));
object(CakeEvent) {
data => null
result => null
}
- CORE/Cake/Routing/Dispatcher.php line 183 → Controller->startupProcess()
*/
protected function _invoke(Controller $controller, CakeRequest $request, CakeResponse $response) {
$controller->constructClasses();
$controller->startupProcess();
- CORE/Cake/Routing/Dispatcher.php line 161 → Dispatcher->_invoke(ProductController, CakeRequest, CakeResponse)
));
}
$response = $this->_invoke($controller, $request, $response);
if (isset($request->params['return'])) {
object(ProductController) {
name => 'Product'
uses => array(
[maximum depth reached]
)
helpers => array([maximum depth reached])
request => object(CakeRequest) {}
response => object(CakeResponse) {}
viewPath => 'Product'
layoutPath => null
viewVars => array([maximum depth reached])
view => 'index'
layout => 'default'
autoRender => true
autoLayout => true
Components => object(ComponentCollection) {}
components => array(
[maximum depth reached]
)
viewClass => 'View'
View => null
ext => '.ctp'
plugin => null
cacheAction => false
passedArgs => array(
[maximum depth reached]
)
scaffold => false
methods => array(
[maximum depth reached]
)
modelClass => 'Catproduct'
modelKey => 'product'
validationErrors => null
Session => object(SessionComponent) {}
News => object(News) {}
}
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array(
[maximum depth reached]
)
url => 'product/index/du-hoc-han-quoc/page:5'
base => ''
webroot => '/'
here => '/product/index/du-hoc-han-quoc/page:5'
}
object(CakeResponse) {
}
- APP/webroot/index.php line 92 → Dispatcher->dispatch(CakeRequest, CakeResponse)
App::uses('Dispatcher', 'Routing');
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array(
[maximum depth reached]
)
url => 'product/index/du-hoc-han-quoc/page:5'
base => ''
webroot => '/'
here => '/product/index/du-hoc-han-quoc/page:5'
}
object(CakeResponse) {
}