在mac上重新安装php时无法加载PostgreSQL驱动程序(El Capitan)

The first time I install php7, every thing work well:

brew install php70
brew install php70-pdo-pgsql

But when I remove it, install php56, remove php56 and reinstall php70 then I got errors:

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-pdo-pgsql/pdo_pgsql.so' - dlopen(/usr/local/opt/php70-pdo-pgsql/pdo_pgsql.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-pthreads/pthreads.so' - dlopen(/usr/local/opt/php70-pthreads/pthreads.so, 9): image not found in Unknown on line 0

How can I fix it?

I've found the answer. We just remove and reinstall these extensions from source.

brew unlink php70-pdo-pgsql
brew unlink php70-pthreads
brew reinstall php70-pdo-pgsql --build-from-source
brew reinstall php70-pthreads --build-from-source