Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How we setup cakephp 3.x without database?

In our project we don't need a database, so how do we setup cakephp 3.x on a local machine without modifying the database config? I have this issue when I'm running my site.

Error: Class 'PDO' not found File /usr/share/nginx/dchannel/vendor/cakephp/cakephp/src/Database/Type.php Line: 100

So please suggest a better way to do disable the database on cakephp 3.x

Thank you in advance.

like image 812
Ngọc Tân Trần Avatar asked Nov 23 '25 22:11

Ngọc Tân Trần


2 Answers

Theoretically that should be possible if you just avoid to touch anything that interacts with the datbase, or uses PDO related constants and stuff, like the Type classes that are by default involved in the applications bootstrap:

https://github.com/cakephp/app/blob/3.5.0/config/bootstrap.php#L174-L189

Also you cannot use Migrations or DebugKit, as both require PDO:

https://github.com/cakephp/app/blob/3.5.0/config/bootstrap.php#L206-L207 https://github.com/cakephp/app/blob/3.5.0/config/bootstrap.php#L211-L217

If you comment these snippets, and do not touch the model layer anywhere, then it should work. However I don't think that there is a guarantee that this will continue to work. If you want to make sure you can ask the core devs over at Slack or IRC, or maybe even open a ticket on GitHub.

like image 142
ndm Avatar answered Nov 25 '25 11:11

ndm


I think it is possible because cakephp use its own design template. so just replace the template with your one . php default template \src\Template\Pages\home.ctp

like image 37
ThataL Avatar answered Nov 25 '25 10:11

ThataL