pgsql is not loading (centOS 6.8)

*First of all don't answer "php.ini >> uncomment extension=pgsql.so and restart httpd". did that millions of times, did not solve my problem.

*Tried hundreds of methods described in different sites including stackoverflow, but unfortunately did not work for me (I am leaning Linux >> noob)

INFO: httpd 2.2.15, php 5.6.26 (remi-php56), CentOS 6.8, postgresql 8.2.9

Error 1:

Fatal error: Call to undefined function mb_convert_encoding() in /var/www/html/bancarella_dev/config.php on line 6

Error 1 was solved by:

yum install php-mbstring
service httpd restart

Error 2:

Fatal error: Call to undefined function pg_connect() in /var/www/html/bancarella_dev/dbconnect.php on line 69

To solve Error 2 I did :

yum install php-pgsql
service httpd restart

But it did not solve the Error 2

To see what extensions are loading, I created a test file "test.php"

Code:

$isPgsql =  extension_loaded('pgsql') ? 'yes':'no';

echo "pgsql loaded: {$isPgsql}" ;

print_r(get_loaded_extensions());

Output of test.php:

pgsql loaded: no

Array
(
    [0] => Core
    [1] => date
    [2] => ereg
    [3] => libxml
    [4] => openssl
    [5] => pcre
    [6] => zlib
    [7] => filter
    [8] => hash
    [9] => Reflection
    [10] => SPL
    [11] => session
    [12] => standard
    [13] => apache2handler
    [14] => bz2
    [15] => calendar
    [16] => ctype
    [17] => curl
    [18] => mbstring
    [19] => fileinfo
    [20] => ftp
    [21] => gettext
    [22] => iconv
    [23] => exif
    [24] => PDO
    [25] => Phar
    [26] => sockets
    [27] => sqlite3
    [28] => tokenizer
    [29] => pdo_pgsql
    [30] => pdo_sqlite
    [31] => json
    [32] => zip
    [33] => mhash
)

SO, mbstring is loaded (that's why error 1 was solved).

From the array you can see that pdo_pgsql is also loaded but pgsql is not.

Why? still getting:

Call to undefined function pg_connect()

Please help.


Solution 1:

I updated PostgreSQL (as @RemiCollet suggested) and everything is working properly.

yum install postgresql96*  
service postgresql-9.6 initdb  
chkconfig postgresql-9.6 on  
service postgresql-9.6 start