如何在Centos 6中将pgsql扩展添加到php

I want to add pgsql extension to php in Centos 6.

I've tried uncommenting these lines in my php.ini file with no luck:

extension=php_pdo_pgsql.dll
extension=php_pgsql.dll

Execute the following commands:

 $ yum install postgresql-devel
 $ pecl download pdo_pgsql
 $ tar xzf PDO_PGSQL-1.0.2.tgz
 $ ./configure --with-pdo-pgsql=/usr/pgsql-9.5
 $ make
 $ sudo make install

Now check that a

*pgsql.so

file exists in the directory:

/usr/lib64/extensions/no-debug-non-zts-20100525/

and also extension_dir of php.ini file is set on this directory. If you want to know the exact path of your php.ini file, create a simple PHP file, in your Apache htdocs or var/www directory, with the following content:

<?php echo 'ini: ', get_cfg_var('cfg_file_path');
?>

And then browse it. Finally add one line to your php.ini file:

extension=pdo_pgsql.so

You've uncommented the windows configuration lines, but you're on a unix system. Uncomment (or add) this line:

extension=pdo_pgsql.so