我找不到在OS X 10.10(干净安装)上安装postgresql数据库的方法。下面是我所做的:
1)从Liip安装PHP 5.6(专门为Symfony构建):http://php-osx.liip.ch/
2)安装Postgres应用程序:http://postgresapp.com/
3)安装Symfony: http://symfony.com/设置参数。yml
parameters:
database_driver: pdo_pgsql
database_host: 127.0.0.1
database_port: 5432
database_name: bachelor
database_user: username
database_password: ~
我已经创建了数据库,验证了我有正确的PHP命令行,正确的pgql命令行等。
我在Symfony中创建了一个包和一些实体(这里没有错误,它与MySQL一起工作)。
但是当我启动任何命令与DB交互时,如"php app/console doctrine:schema:update --dump-sql
",我有这个错误:
[PDOException]
SQLSTATE[HY000] [2006] MySQL server has gone away
[SymfonyComponentDebugExceptionContextErrorException]
Warning: PDO::__construct(): MySQL server has gone away
但是为什么呢?我不使用MySQL服务器…
有人有解决办法吗?
谢谢!
你能给我们展示一下你的/app/config/config。yml吗?请
是否更改了dbal连接值?
# Doctrine Configuration
doctrine:
dbal:
default_connection: pgsql
connections:
#Postgresql
pgsql:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8