SQLSTATE[HY000] [14] unable to open database file


#1

Hello team, I 'm using cakephp 3.5 on my CENTOS server but after installing application and managing config/App.conf file, when I run the application, I have the SQLSTATE error [HY000] [14] unable to open database file.

How can i fixe it


#2

Please try Google first. The error explains already that the database can’t be opened, either because it is not up and running, not accessible using the given parameters, or even too many connections. Have you checked all this, particularly in stackoverflow.com? Due diligence first.


#3

That error is a sqlite error. If you aren’t using sqlite for your main database, then the cause is almost certainly debugkit not being able to access/write it’s internal sqlite database.

You have three options:

  1. If this is your production server, switch off debug mode (in app.php). You never want debug enabled on production because it can (rather will) expose your database and other credentials to the world.
  2. Make the tmp/ directory writable by the www user (Not sure exactly what it is for centos)
  3. Configure debug kit to use a different database as documented here: https://book.cakephp.org/3.0/en/debug-kit.html#database-configuration