Friday, February 18, 2022

[FIXED] Missing Database Connection cakephp

Issue

I can't connect my cakephp application with mysql database. when I run it in localhost it works but when I move to a remote server it doesn't and it gives this error:

Missing Database Connection

I tried these solutions but it was vain in all cases:

  • Commented out : skip-networking.
  • edited the LocationMatch bloc in the htppd-xamp.conf yet still no changes

Below is the code of the connection to the DB:

<?php
class DATABASE_CONFIG {

    public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => '51.254.205.243',
        'login' => 'login',
        'password' => 'pwd',
        'database' => 'db',
        'prefix' => '',
        'encoding' => 'utf-8'
    );
}

If you really know what is going on and how to fix this issue, I would be grateful to learn from you.

Regards


Solution

Change host to 127.0.0.1 / localhost



Answered By - P.Banerjee

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.