0

I am using CakePhp 2.8.5 and I have a following configuration in database.php

class DATABASE_CONFIG {

    public $default = array(
        'datasource' => 'Database/Sqlite',
        'persistent' => false,
        'database' => 'MyDB.sqlite3',
        //'encoding' => 'utf8',
    );

    public $test = array(
        'datasource' => 'Database/Sqlite',
        'persistent' => false,
        'database' => 'MyDB-test.sqlite3',
        //'encoding' => 'utf8',
    );
}

My sqlite database files are on the root folder of my cakephp web app. Both the sqlite file have read/write/execute permission for everyone. My Php.ini file configuration has PDO extension enabled for sqlite. I am able to connect to sqlite3 database using my CakePHP internal web server using following command on MAC OS X 10.11.5 terminal : ./lib/Cake/Console/cake server -p 8080

But when I try to run it on my XAMPP server on MAC OS X using the web app configured in vhost.conf as below, it fails to connect to sqlite3 db.

<VirtualHost *:80>
    ServerName cakeapp
    DocumentRoot "/Users/userXXX/website/cakeapp"
    <Directory "/Users/userXXX/website/cakeapp">

        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride all
         Require all granted
    </Directory>

    ErrorLog "/Users/userXXX/website/cakeapp/error.log"
</VirtualHost>

However, I am getting following error message when I connect to cakephp web app on my local apache http server (cakeapp/):

CakePHP is NOT able to connect to the database.
Database connection "Sqlite" is missing, or could not be created.

So why does it works when I connect to cakeapp using internal http server ( localhost:8080) and does not work when I try to connect to it from my localhost default apache web server in XAMPP?

Andy
  • 2,493
  • 6
  • 37
  • 63
  • I was able to resolve this by setting the write permission on folder (for all groups) within which sqlite files reside. Also found the similar solution here - http://stackoverflow.com/questions/3319112/sqlite-read-only-database – Andy Jul 05 '16 at 00:00
  • I think the problem lies with the group permission. First, I set the read-write-execute permission for my apache group on the sqllite3 files. Next, I set the write permission on folder (for apache group) within which sqlite files reside. Also found the similar solution here - http://stackoverflow.com/questions/3319112/sqlite-read-only-database – Andy Jul 05 '16 at 00:07

0 Answers0