php - osx mavericks 上的 pg_connect 未定义函数

标签 php macos postgresql

我查看了多个 SO 线程,但似乎都没有我的问题。我已经编译并安装了 pro_pgsql 扩展,如下所示:http://blog.rupey.org/post/63221360055/adding-postgres-support-to-php-on-os-x-mavericks并通过运行 php -m 验证它已加载,apache 已重新启动,php_info 显示以下内容: enter image description here

但是当我运行这个脚本时:

echo "hi!";
$ebdb_conn = pg_connect('dbname=mydb user=frank password=frank123') or die(pg_last_error());

我在日志中收到以下错误:

[Mon Jun 09 12:39:05 2014] [error] [client ::1] PHP Fatal error:  Call to undefined function pg_connect() in /Users/frank/Code/ebus/test.php on line 4

这是在 OSX Mavericks 上,使用 Apache 和 PHP 5.2.24。有什么想法吗?

最佳答案

这个问题最终通过卸载与 Enterprise DB postgres 包有关的所有内容并使用一组一致的包重新安装来解决。不幸的是,我的机器上仍然有一个不匹配的 psql 客户端,但除此之外它工作正常。对于其他人看到这一点,我建议:

不要使用在 OSX Mavericks 上的 postgres 网站上找到的企业数据库安装程序使用以下之一

1) postgres 应用程序 ( http://postgresapp.com ) 很好,因为它内置了 postGIS 和其他扩展

2) 映射端口包 ( https://trac.macports.org/browser/trunk/dports/databases/postgresql82/Portfile )

3) brew 安装程序 ( http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/ )

关于php - osx mavericks 上的 pg_connect 未定义函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24126950/

相关文章:

php - 使用 php 为单个页面选择独特的样式表

javascript - PHP 使用 json stringify 对象

objective-c - 在 Cocoa 中设置 NSAlert 级别

javascript - JOIN 查询在 Node-postgres 中不起作用

database - 杀死 autovacuum 的危险 : VACUUM queries (to prevent wraparound)

sql - Postgresql 8.4 - 限制窗口函数范围

php - 是否可以从本地主机转到外部地址

php - CodeIgniter View 不解析 PHP

c++ - 错误 : out-of-line definition of 'test' does not match any declaration in 'B<dim>'

php - 如何修复 OpenSSL 协议(protocol) Composer 的错误?