Problem with PHP / Postgresql on CentOS6.2

Home » CentOS » Problem with PHP / Postgresql on CentOS6.2
CentOS 8 Comments


I have instaled a WEB server with Postgresql on CentOS 6.2, PostgreSQL version 9.1.3 x64 from EntrrpriseDB base *.run*. PHP with PDO from YUM using reposity versions.

On start apache does not get error. PHP LOG under, with PDO error.

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/' - failed to map segment from shared object: Permission denied in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/' - failed to map segment from shared object: Permission denied in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/' - failed to map segment from shared object: Permission denied in Unknown on line 0
[Tue Mar 27 09:35:17 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3
mod_ssl/2.2.15 OpenSSL/1.0.0-fips configured -- resuming normal operations

I try to reinstall all PHP modules and get this messages

Installing :
Installing :
Installing :
*/sbin/ldconfig: /opt/PostgreSQL/psqlODBC/lib/ is not a symbolic
Installing :
Installing :
Installing :

PostgreSQL an APACHE runs normal and PHP does not recognize

How i fix this mess?



8 thoughts on - Problem with PHP / Postgresql on CentOS6.2

  • Hello Rudinei,

    By not mixing dependent packages from different repos, unless you are
    prepared to fix and rebuild them.

    Is there any reason you cannot use the postgresql distributed with the
    distro? If you do have to use a more recent version it’s usually the
    easiest approach to either use a Fedora SRPM or to use the RHEL SRPM and
    pop in a more recent tarball. In either case you might have to fix the
    SPEC file to remove stale patches, update/fix dependencies etc. YMMV.

  • Em 27 de março de 2012 10:15, Leonard den Ottolander <> escreveu:

    Yep, I need PostgreSQL 9.1 for especific feature, but actual repository is
    Seeing postgresql ftp, the newest version (for x64 RHEL 6 / Fedora) is
    9.0.2, and does not provide aditionals (pgadmin / pdo / etc…)
    The only i found is from EntrepriseDB installer

    I understood the concept but do not know how to apply it. Its possible correct
    the links of the file (thats creating the problem in this case /
    opt/PostgreSQL/psqlODBC/lib/ into symbolic link? Pointing to
    what? Or am I totally crazy?
    Sorry for my bad English.

  • The problem you are having with pgsql not talking to php is not related
    the error you see with the php-embeded install. The script that is
    running is running after the install of php-embedded is calling the
    command “ldconfig”. The purpose is to rebuild the linker cache so that
    CentOS knows where shared libraries are.

    You need to look in /etc// at all the files and find the
    ones concerning pgsql … and see what they have to say about the file
    in question (/opt/PostgreSQL/psqlODBC/lib/ and fix it if
    there is a problem with that file. This is an issue (and you need to
    fix it), but it does not have anything to do with pgsql not recognizing
    your PHP.

    You also are going to need to install a php-pgsql.rpm in order to get
    php to work with pgsql. However, that rpm
    (php-pgsql-.x86_64.rpm) from the CentOS distribution is
    probably not going to work. It expects to find the shared library in /usr/lib64/ and was built against the 8.4.9
    libraries included in CentOS. You are going to need to rebuild the php
    RPM with it instead pointing at the new libraries and headers from the
    new postgresql that you want to use.

    I would suspect that you are going to need to rebuild any of these
    packages (if you want to use them) against the new development libraries
    for the new version of postgresql that you want to use:

    Remember, this stuff (CentOS) is all built to work together and if you
    want to go outside of that, you have to not only rebuild the specific
    package in question, but also any packages that link against that
    package and use its shared libraries.

    You can try to install the distro version of php-pgsql, it is possible
    it will work. You will need to remove any of the centos pgsql items
    though and make sure the new libraries are in the ldcache.

    Johnny Hughes

  • Em 27 de março de 2012 11:47, Johnny Hughes escreveu:

    Thanks Johnny!

    you rocks!

    ldconfig was mapping /opt/postgresql by ldconfig of pgsqlODBC (I wont need
    Once commented
    runs ldconfig
    and restarted postgresql and httpd
    and now all its fine!


  • Em 27 de março de 2012 14:54, John R Pierce escreveu:

    Thanks, John.
    that is was i look for.
    The postgreSQL documentation about yum/centos/rhel must be updated.


  • [Mostly for the archives…..]

    The CentOS AdditionalRepositories Wiki page provides the links necessary to find the latest PostgreSQL packages; see

    The PostgreSQL packaging team does a fine job of dealing with the issues that will arise when a core package is updated in this way, but, at the same time, if you use them you will be making your CentOS install ‘non-stock’ and thus support is more difficult (on real RHEL, installing anything not in the official RHN repos can void your support entirely….).

    I once did that work, alone, but now there is a great team making a good repo for the latest (and older versions, up to a point) PostgreSQL. And I use their 9.1 packages on C4, C5, and C6 to good effect.

    YMMV, of course.