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.

Upvotes: 3

Views: 665

Answers (3)

ndm
ndm

Reputation: 60463

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.

Upvotes: 2

ThataL
ThataL

Reputation: 165

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

Upvotes: 1

Lorna Mitchell
Lorna Mitchell

Reputation: 1986

I don't think it's possible to set up CakePHP without a database; it is basically a frontend to a database so the tool doesn't work without one, and I think it also uses it to store some of its configuration. If you don't need a database, then I advise you choose a different framework.

Upvotes: 0

Related Questions