CakePHP 4 Installation Database Error – Missing Datasource

Share this Article

When we install CakePHP 4 application in local system or anywhere, we get some times missing datasource configuration error. So, what we have to do to fix this, we will see in this article.

Inside this article we will discuss CakePHP 4 installation database error. To fix this, we have a very few simple steps. Look at this image, this kind of error we will fix in this article – Missing datasource Configuration Error.

Let’s get started.


CakePHP 4.x Installation at System

Before installation of CakePHP we need some system requirements and it’s configuration. Here, System configuration means Server, PHP, Extensions, Database etc.

To know about basic installation settings to system, server to get this framework, you need to follow the guidelines of cakephp official document of. This document makes clear about what we need initially to set the things in a better way.

Additionally, we need composer at system. Composer is a tool which used to manage PHP dependencies, libraries etc .We will use composer to install CakePHP. So, first you need to install composer. If you have already installed or exists at your system, you can verify by command –

$ composer

If composer has been installed then this command will list all available commands of composer other wise you will get error something composer command not found.

Click here for the article – How to Install composer in ubuntu

Assuming Composer exists at system.

Let’s create a CakePHP project at system –

$ composer create-project --prefer-dist cakephp/app:~4.0 mycakephp

Above command will creates a project with the name called mycakephp.


Application Web Development

To start built-in webserver, type this command to terminal.

$ bin/cake server -p 8765

Open browser and type URL to open application –

http://localhost:8765/

OR

http://127.0.0.1:8765/

Error

Missing Datasource Configuration error
the datasource configuration debug_kit was not found in config\app.php

To fix this, let’s see what we can do.


Datasource Configuration debug_kit Not Found

When we install CakePHP 4 setup, it requires extension=pdo_sqlite must be enabled. If it is not then we get this error.

How can we check – pdo_sqlite extension is enabled or not?

Steps to Verify

Create a file info.php at your localhost directory.

<?php
  
  phpinfo();

When we open into browser – http://localhost/info.php

So, here as we can see SQLite PDO module is enabled.

How to Install SQLite PDO Extension ?

If you are using Ubuntu OS. Open terminal and run these command.

Step #1 – Updating existing package

$ sudo apt-get update

Step #2 – Install SQLite module

For PHP v7.0

$ sudo apt-get install php7.0-sqlite

For PHP v7.2

$ sudo apt-get install php7.2-sqlite

For PHP v7.4

$ sudo apt-get install php7.4-sqlite

Step #3 – Restart Apache Server

$ sudo service apache2 restart

Again start CakePHP 4 built-in development server.

Hopefully, after doing these steps, error will be resolved.

We hope this article helped you to learn CakePHP 4 Installation Database Error – Missing Datasource configuration in a very detailed way.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Leave a Comment