[CentOS] Problem with PHP / Postgresql on CentOS6.2

Tue Mar 27 14:47:12 UTC 2012
Johnny Hughes <johnny at centos.org>

On 03/27/2012 08:51 AM, Rudinei Dias wrote:
> Em 27 de março de 2012 10:15, Leonard den Ottolander <
> leonard at den.ottolander.nl> escreveu:
>> Hello Rudinei,
>> On Tue, 2012-03-27 at 09:49 -0300, Rudinei Dias wrote:
>>> I have instaled a WEB server with Postgresql on CentOS 6.2.
>>> PostgreSQL, versin 9.1.3 x64 from EntrrpriseDB base *.run*.
>>> PostgreSQL an APACHE runs normal and PHP does not recognize
>>> php_pgsql/pdo_pgsql.
>>> How i fix this mess?
>> 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?
> 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
>> 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.
> 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-<version>.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:

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20120327/b7b46dea/attachment-0004.sig>