Next Chapter: cakePHP 4: building about page with email form

Define Connection to the Database for CakePHP 4

2019-06-29 15:45:16+00

Next we need to define a connection to the database. The configuration file is located in config/app.php.

At least you must modify the username, password and database name for the datasources "default" and "debug_kit".


   'Datasources' => [
        'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Postgres',
            'persistent' => false,
            'host' => 'localhost',
            'username' => 'ENTER-USERNAME',
            'password' => 'ENTER-PASSWORD',
            'database' => 'ENTER-DATABASENAME',
            'timezone' => 'UTC',
            'flags' => [],
            'cacheMetadata' => true,
            'log' => false,
            'quoteIdentifiers' => false,
        'debug_kit' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Postgres',
            'persistent' => false,
            'host' => 'localhost',
            'username' => 'ENTER-USERNAME',
            'password' => 'ENTER-PASSWORD',
            'database' => 'ENTER-DATABASENAME',
            'timezone' => 'UTC',
            'flags' => [],
            'cacheMetadata' => true,
            'log' => false,
            'quoteIdentifiers' => false,

Tag: cakephp4

Next Chapter: cakePHP 4: building about page with email form