如何使用Symfony 2.0将数据库更改为postgresql? [英] How to change a database to postgresql with Symfony 2.0?
本文介绍了如何使用Symfony 2.0将数据库更改为postgresql?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Debian下有一个Symfony2项目。将数据库更改为postgresql的步骤是什么?
I have a Symfony2 project under Debian. What are the steps to change my database to postgresql ?
注意:已提出问题此处,但我相信它与symfony 1.4一样。
Note: The question has been asked here, but it is with symfony 1.4, I believe.
推荐答案
在debian下安装postgresql:
Install postgresql under 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
在/etc/php5/apache2/php.ini中,添加: (实际上这是可选的)
In /etc/php5/apache2/php.ini, add: (this is in fact optional)
extension=pdo.so
extension=php_pdo_pgsql.so
更改symfony apps / config / paramters.ini文件:
Change the symfony apps/config/paramters.ini file:
[parameters]
database_driver: pdo_pgsql
database_host: localhost
database_port: null
database_name: mypgdatabase
database_user: mypguser
database_password: mypguserpass
放松项目:
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
参考文献:
这篇关于如何使用Symfony 2.0将数据库更改为postgresql?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文