2012-05-14 2 views
12

데비안에서 Symfony2 프로젝트를 사용하고 있습니다. 데이터베이스를 postgresql로 변경하는 단계는 무엇입니까?Symfony 2.0에서 데이터베이스를 postgresql로 변경하는 방법은 무엇입니까?

참고 : 질문은 here으로 질문되었지만 심포니 1.4와 관련이 있습니다.

+0

당신이 사용하는 두 연결을 희망하는 경우, 여기 좀 봐 : http://stackoverflow.com/questions/8440403/how-to- create-2-connections-mysql-and-postgresql-with-doctrine2-symfony2 – Nll

답변

34

데비안에서 PostgreSQL의 설치 : 추가, /etc/php5/apache2/php.ini에서

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 

:

extension=pdo.so 
extension=php_pdo_pgsql.so 

변경 (이 옵션 사실상)은 온라인 애플리케이션/설정/paramters.ini 파일 :

[parameters] 
    database_driver: pdo_pgsql 
    database_host:  localhost 
    database_port:  null 
    database_name:  mypgdatabase 
    database_user:  mypguser 
    database_password: mypguserpass 

Relaod 프로젝트 :

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 documentation for configuring databases

Postgresql installation under debian

+0

postgres에 mypguser로 실행하도록 말하면 안됩니까? 아니면 왜 adduser를하고 있습니까? – Hendrik

+0

@Hendrik, 맞습니다. adduser를 할 필요가 없습니다. – Prisoner

관련 문제