在Ubuntu10中安装pdo_pgsql无法正常工作

时间:2015-11-06 07:58:49

标签: php apache postgresql

我试图在ubuntu 10.04和PHP 5.4.37中安装pdo_pgsql。实际上postgresql已安装并正常使用phppgadmin。

现在问题是缺少pgsql的pdo驱动程序。

当我输入pecl install pdo_pgsql

时,我为pgsql安装了pdo
# sudo pecl install pdo_pgsql
`pecl/pdo_pgsql is already installed and is the same as the released version 1.0.2

并在/etc/php5/apache2/conf.d/中添加了一个新的pgsql.ini文件 extension=pdo_pgsql

当我运行phpinfo()

我能看到

/etc/php5/apache2/conf.d/pgsql.ini,
Additional .ini files parsed

中的

但我无法看到PDO中加载的驱动程序,只加载了mysql和sqlite。

我从服务器获得的附加消息,

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

FYI,

即使我尝试了

# sudo apt-get install php5-pgsql

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
  php5-pgsql: Depends: phpapi-20090626
              Depends: php5-common (= 5.3.2-1ubuntu4.30) but 5.4.37-1+deb.sury.org~lucid+1 is to be installed
E: Broken packages

请建议我如何进一步。

我甚至重新启动了apache和服务器本身。

由于

1 个答案:

答案 0 :(得分:0)

apt-get install php5-pgsql

试试这个

----------------------------------------- REMOVE

sudo apt-get purge php5-pgsql

使用此功能删除pgsqlphp5-pgsql php-pgsql php4-pgsql

取决于php尝试的内容