-
Notifications
You must be signed in to change notification settings - Fork 4
Connection to database
Nicolas edited this page Apr 6, 2021
·
2 revisions
Connection to the database is made using parameters in a configuration file config/database.yaml
For PosgreSQL the content of that file can be:
parameters:
database_driver: 'pdo_pgsql'
database_name: 'database_name'
database_host: 'localhost'
database_user: 'database_user'
database_password: 'database_password'
database_prefix: 'phyxo_'
If you'd prefer using connection through unix socket, you can change database_host and have something like that:
parameters:
database_driver: 'pdo_pgsql'
database_name: 'database_name'
database_host: '/var/run/postgresql' # directory that contains the socket file.
database_user: 'database_user'
database_password: 'database_password'
database_prefix: 'phyxo_'
For MySQL the content of that file can be:
parameters:
database_driver: 'pdo_mysql'
database_name: 'database_name'
database_host: 'localhost'
database_user: 'database_user'
database_password: 'database_password'
database_prefix: 'phyxo_'
For SQLite the content of that file can be:
parameters:
database_driver: 'pdo_sqlite'
database_name: '%kernel.project_dir%/db/phyxo.db'
database_prefix: 'phyxo_'
Since SQLite does not support row level locks but locks the whole database, it's better to use native session saved to files. Create or append to config/services_prod.yaml file following lines :
framework:
session:
handler_id: session.handler.native_file