Azure AppService PHP 8.0: Cannot install php-pgsql extension

Greg Brandt 1 Reputation point
2022-04-13T15:23:00.237+00:00

I have an AppService PHP 8.0 instance running. I enabled the php_pgsql extension and tried to install the extension using apt-get install php-pgsql but I get the following error.

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php-pgsql is a virtual package provided by:
php7.3-pgsql 7.3.31-1~deb10u1 [Not candidate version]
php7.3-pgsql 7.3.29-1~deb10u1 [Not candidate version]

E: Package 'php-pgsql' has no installation candidate

Is there another way to install this package?

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
208 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andriy Bilous 10,901 Reputation points MVP
    2022-04-18T11:33:20.647+00:00

    Hello @Greg Brandt

    Please try the following to enable the php-pgsql extension for PHP on Azure Web Apps:

    Install extension

    echo "deb http://ftp.de.debian.org/debian buster main" >> /etc/apt/sources.list  
    
    apt-get update && apt-get install -y libpq-dev  
    
    docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql  
    
    docker-php-ext-install pdo pdo_pgsql pgsql  
    

    Follow the guide of https://azure.microsoft.com/en-us/documentation/articles/web-sites-php-configure/#how-to-enable-extensions-in-the-default-php-runtime to configure in PHP runtime.

    Restart the site after configuring the settings.

    1 person found this answer helpful.