Install pdo for postgres Ubuntu

前端 未结 5 400
清歌不尽
清歌不尽 2020-12-02 15:49

I am trying to enable the pdo driver for my php installation, but when I runn the command

./configure --prefix=/usr/local/webserver/php --with-apxs2=/usr/loc         


        
相关标签:
5条回答
  • 2020-12-02 15:50

    Try the packaged pecl version instead (the advantage of the packaged installs is that they're easier to upgrade):

    apt-get install php5-dev
    pecl install pdo
    pecl install pdo_pgsql
    

    or, if you just need a driver for PHP, but that it doesn't have to be the PDO one:

    apt-get install php5-pgsql
    

    Otherwise, that message most likely means you need to install a more recent libpq package. You can check which version you have by running:

    dpkg -s libpq-dev
    
    0 讨论(0)
  • 2020-12-02 15:50

    If you're using the wonderful ondrej/php ubuntu repository with php7.0:

    sudo apt-get install php7.0-pgsql
    

    For ondrej/php Ubuntu repository with php7.1:

    sudo apt-get install php7.1-pgsql
    

    Same repository, but for php5.6:

    sudo apt-get install php5.6-pgsql
    

    Concise and easy to remember. I love this repository.

    0 讨论(0)
  • 2020-12-02 16:02

    Pecl PDO package is now deprecated. By the way the debian package php5-pgsql now includes both the regular and the PDO driver, so just:

    apt-get install php-pgsql
    

    Apache also needs to be restarted before sites can use it:

    sudo systemctl restart apache2
    
    0 讨论(0)
  • 2020-12-02 16:12

    If you are using PHP 5.6, the command is:

    sudo apt-get install php5.6-pgsql
    
    0 讨论(0)
  • 2020-12-02 16:15

    PDO driver for PostgreSQL is now included in the debian package php5-dev. The above steps using Pecl no longer works.

    0 讨论(0)
提交回复
热议问题