php的pgsql编译版本不一致,如何修正?

在CLI模式运行PHP,给出警告:

PHP Warning: PHP Startup: pdo_pgsql: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: pgsql: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0

看提示应该是说pgsql和php用的api版本不一致,可是google了好半天,没有好到办法如何重新编译pgsql。谁帮忙看看哈。

阅读 4.7k
1 个回答

你首先搞清楚,出问题的是 php-pgsql 模块,不是 pgsql 这个数据库。

你的模块使用的是旧版本的 PHP API,而 PHP 已经是新版本的 API 了。也就是说,你的 PHP 版本和 php-pgsql 模块的版本差异过大。

你是从哪里安装的 PHP 又是从哪里安装的 php-pgsql 啊?如果是 Linux 的话,推荐从软件源里安装相关包,这样版本一定是兼容的。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题