I'm using pdo_mysql
for prod, stag and dev environments and pdo_sqlite
for test environment. The problem is that loading Doctrine Data Fixtures generates unable to open database file
error as shown below. I assigned the permissions to cache folder as defined in symfony website and also tried with 777 but no luck.
I'm on MAC OS Yosemite and sqlite3 is enabled in PHP.
PDO drivers mysql, sqlite, dblib, pgsql
SQLite3 module version 0.7-dev
SQLite Library 3.8.8.3
This command creates the database successfully:
MBP:football bc$ php app/console doctrine:schema:update --force --env=test
Updating database schema...
Database schema updated successfully! "9" queries were executed
This command fails:
MBP:football bc$ php app/console doctrine:fixtures:load --no-interaction --no-debug --env=test
[PDOException]
SQLSTATE[HY000] [14] unable to open database file
config_test.yml (both configs won't work)
doctrine:
dbal:
driver: pdo_sqlite
path: %kernel.cache_dir%/default.db
charset: UTF8
#doctrine:
# dbal:
# default_connection: default
#
# connections:
# default:
# driver: pdo_sqlite
# path: %kernel.cache_dir%/default.db
# charset: utf8
config.yml
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
UPDATE:
Settings/steps above work fine in Ubuntu so this is a MAC OS related issue. Mac users, any idea why?
As suggested in Symfony website, if you run into a kind of permissions issue, Mac users should use specific permissions on
app/cache
folder by running commands below:Actually this is what causes the problem so to solve this issue run:
and do not assign any permissions to
cache/test
folder.