I have a postgresql database which I can connect to via the PhpStorm IDE. However, when I try to access it from PHP code, I get the error 'could not find driver'. My code follows the pattern of a simple 'how to' page from W3Schools - I would paste the URL but you seem to have disabled paste in this editor.
The key command is a call to create a new PDO object, passing it the URI which works for the IDE (which starts with 'jdbc:postgresql://[server hostname]:5432/[database]'). The SQL is a call which works fine interactively.