Tory Tory - 1 year ago 67
PHP Question

Using PGSQL in PHP

I am using Putty to access a server here at work. I am in charge of maintaining a website, that has, up til now, been using mssql and php. We are making a transition to Postgres, and I am needing to change from mssql to pgsql.

When trying to use some of the pgsql functions, I am getting the undefined function error, which leads me to think that I don't have the pgsql (package?) installed. I've searched many other questions for something similar, and the response that typically is given, and works for the asker is to do the command:

sudo yum install php-pgsql

The output I get is:

Loaded plugins: rhnplugin, security There was an error communicating
with RHN. RHN Satellite or RHN Classic support will be disabled. Error
communicating with server. The message was:

Error Message:
Please run rhn_register as root on this client Error Class Code: 9 Error Class Info: Invalid System Credentials. Explanation:
An error has occurred while processing your request. If this problem
persists please enter a bug report at
If you choose to submit the bug report, please be sure to include
details of what you were trying to do when this error occurred and
details on how to reproduce this problem.

Setting up Install Process No package php-pgsql available. Nothing to

I've read up a little on the Error Class Code: 9, and it looks like it has something to do with redoing credentials, which I am not at liberty to do.

Being new to this, I asked one of my co-workers if they knew what to do. They mentioned something about an RPM, which me being new to this, had to look up and see what it was. I'm still a little fuzzy.

In my mind (which contains a little programming knowledge), I would install a library or package into a folder or directory, and then have a require_once statement make reference to that library.

I know this question is very confusing, and not very clear, but basically, I would like to use pgsql, which at the moment doesn't seem to be working (or maybe installed).

Additional Information:

Linux Distro: Red Hat Enterprise Linux Server release 5.7 (Tikanga)

PHP Version: 5.3.6

Putty Release: 0.62

Thank you for taking the time and effort to help me, I greatly appreciate it!

Tim Tim
Answer Source

Programs and libraries, or parts of programs are libraries, get built into "rpm" files, which I'll refer to as packages. The "yum" program contacts a remote server and downloads rpm files and installs them for you. Most packages require other packages, for example php-pgsql requires both php packages and pgsql packages in order to work. Yum figures out the dependancies for you.

But there's something wrong. You're using Red Hat Enterprise, and it seems that you can't talk to their server. You should probably use your support contract with Red Hat to solve the problem.

But one alternative option is to download the rpm's that you need and install them with 'rpm -i' instead of letting yum do that for you.

But if you do that, you have to find rpm's build for your specific version of RHE, or you'll run into compatibility problems.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download