CakePHP 4 Installation Database Error – Missing Datasource

Reading Time: 3 minutes
6,451 Views

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 Installation

To create a CakePHP project, run this command into your shell or terminal. Make sure composer should be installed in your 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.

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

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.