我无法让PHP连接到PGSQL。我正在运行小牛10.9.4。以下是我遵循的步骤:
which php
)rmdir
该目录brew install php54
php -v
显示新的php 5.4 php -m
显示没有pdo_pgsql
模块brew install php54-pdo-pgsql
php -m
显示pdo_pgsql
模块php -i
显示以下信息
PDO support => enabled
PDO drivers => mysql, odbc, sqlite, pgsql
pdo_mysql
PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $
Directive => Local Value => Master Value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock
PDO_ODBC
PDO Driver for ODBC (unixODBC) => enabled
ODBC Connection Pooling => Enabled, strict matching
pdo_pgsql
PDO Driver for PostgreSQL => enabled
PostgreSQL(libpq) Version => 9.4.4
Module version => 1.0.2
Revision => $Id: 8e4cc97fb53f418d98b489c3e9d722e48446e676 $
/usr/local/etc/php/5.4/php.ini
并添加extension=pgsql.so
,然后保存sudo apachectl restart
mysql, sqlite
Loaded Configuration File
部分显示了php.ini与pgsql扩展名相同的文件每当我在控制台中运行php命令时,我都会看到
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so' - dlopen(/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so' - dlopen(/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so, 9): image not found in Unknown on line 0