Table of Contents
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 –
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/
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.
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.
Hi, I am Sanjay the founder of Online Web Tutor. I welcome you all guys here to join us. Here you can find the web development blog articles. You can add more skills in web development courses here.
I am a Web Developer, Motivator, Author & Blogger. I also used to take online classes including tech seminars over web development courses. We also handle our premium clients and delivered up to 50+ projects.