Install postgresql dưới debian:
apt-get install postgresql postgresql-client
apt-get install php5-pgsql
adduser mypguser
su - postgres
psql
CREATE USER mypguser WITH PASSWORD 'mypguserpass';
CREATE DATABASE mypgdatabase;
GRANT ALL PRIVILEGES ON DATABASE mypgdatabase to mypguser;
\q
Trong /etc/php5/apache2/php.ini, thêm: (điều này là trong thực tế không bắt buộc)
extension=pdo.so
extension=php_pdo_pgsql.so
Thay đổi các ứng dụng symfony/config/paramters.ini tệp:
[parameters]
database_driver: pdo_pgsql
database_host: localhost
database_port: null
database_name: mypgdatabase
database_user: mypguser
database_password: mypguserpass
Hãy thay đổi dự án của bạn:
php bin/vendors update
php app/console assets:install web
php app/console doctrine:schema:create
php app/console doctrine:fixtures:load
chmod 777 -R app/cache app/logs
Bạn đã hoàn tất!
Tài liệu tham khảo:
Symfony documentation for configuring databases
Postgresql installation under debian
Nguồn
2012-05-14 21:37:31
Nếu bạn hy vọng sử dụng hai kết nối, chỉ cần có một cái nhìn ở đây: http://stackoverflow.com/questions/8440403/how-to- create-2-connections-mysql-và-postgresql-with-doctrine2-in-symfony2 – Nll