How to instal php_pgsql extension for php7 on Ubuntu 12.04 or 14.04

Hi,

I am trying to install the php_pgsql extension for php7 on ubuntu 12.04 or 14.04.
I have tried doing this with sudo apt-get install php7.0-pgsql
I’ve also linked the pgsql.ini and pgsql.do

However, I run into the warning
Warning: PHP Startup: Unable to load dynamic library..... undefined symbol: pcre_free in Unknown on line 0

Any pointers on how I can install the extension ?

Thanks.