PHP Startup: Unable to load dynamic library 'pdo_pgsql' on Ubuntu 18.04

I have been having an issue in my server for a while now. My php keeps returning a warning PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/lib/php/20170718/pdo_pgsql (/usr/lib/php/20170718/pdo_pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/ (/usr/lib/php/20170718/ cannot open shared object file: No such file or directory)) in Unknown on line 0

Anytime this error is returned, my server request fails and hence my system fail.

I cannot install anything using apt or dpkg because all packages are broken. I don’t know how to fix this issue and any ideas or guide will be appreciated.

I currently run php 7.2 and I believe this issue started when I wanted to install php 7.3 and it failed. Apache server, Yii2 framework

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @abebohmuzikol,

Can you try removing your pdo_pgsql PHP driver with apt to see if that would work first:

apt remove pdo_pgsql


apt remove php-pgsql

You might need to add the version are using 7.3

apt remove php73-pgsql

You must properly install the PostgreSQL module and enable it. ([PHP PHSQL installation]

P.S. do not use ‘.dll’ files on the servers with UNIX based OS, because these extensions are compiled for the Windows operating system (for UNIX based OS you must use ‘.so’ files).