Problem with PHP / Postgresql on CentOS6.2

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

HI.

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/pdo_pgsql.so' - libpq.so.5: 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/pdo_pgsql.so' - libpq.so.5: 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/xsl.so' - libxslt.so.1: 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 :
php-xml-5.3.3-3.el6_2.6.x86_64
14/24
Installing :
php-intl-5.3.3-3.el6_2.6.x86_64
15/24
Installing :
php-embedded-5.3.3-3.el6_2.6.x86_64
16/24
*/sbin/ldconfig: /opt/PostgreSQL/psqlODBC/lib/libpq.so.5 is not a symbolic
link*
Installing :
php-soap-5.3.3-3.el6_2.6.x86_64
17/24
Installing :
php-mbstring-5.3.3-3.el6_2.6.x86_64
18/24
Installing :
php-snmp-5.3.3-3.el6_2.6.x86_64
19/24

PostgreSQL an APACHE runs normal and PHP does not recognize
php_pgsql/pdo_pgsql.

How i fix this mess?

Thanks.

 

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 <
    leonard@den.ottolander.nl> escreveu:

    Yep, I need PostgreSQL 9.1 for especific feature, but actual repository is
    8.4.9.
    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
    http://www.enterprisedb.com/products-services-training/pgdownload

    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/libpq.so.5) 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//ld.so.conf.d/ 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/libpq.so.5) 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
    libpq.so.5 in /usr/lib64/libpq.so.5 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:
    apr-util-pgsql.x86_64
    dovecot-pgsql.x86_64
    libdbi-dbd-pgsql.x86_64
    mod_auth_pgsql.x86_64
    php-pgsql.x86_64
    rsyslog-pgsql.x86_64
    uuid-pgsql.x86_64

    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.

    Thanks,
    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
    this)
    Once commented ld.so.conf.d/psqlODBC.conf
    runs ldconfig
    and restarted postgresql and httpd
    and now all its fine!

    Thanks

  • 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.

    Gracias

  • [Mostly for the archives…..]

    The CentOS AdditionalRepositories Wiki page provides the links necessary to find the latest PostgreSQL packages; see http://wiki.centos.org/AdditionalResources/Repositories

    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.

LEAVE A COMMENT