I tried these commands to install php5-pgsql but I got an error:

pi@raspberrypi:~ $ sudo apt-get install php5-pgsql php-pear
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-pgsql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

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

How can I solve this?

1 Answer 1


PHP5 packages are not available in Stretch (see the package lists for php5-pgsql, and note that there are packages for Wheezy, Jessie and Sid, but not Stretch). You can either:

  • Use PHP7 and install php7.0-pgsql and any other relevant packages for PHP7.
  • Use an alternative package source like deb.sury.org, which offers PHP 5 packages for Debian 9 (and this includes ARM builds that are compatible with the Pi).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.