Jump to content
xisto Community
Sign in to follow this  

Does Astahost Support pg_connect?

Recommended Posts

I was building a simple database to login to a survey I was writing for class. Before I ever started testing the actual survey I came across a

Call to undefined function: pg_connect()

I'm just curious is Xisto supports this function. In php.net it says that as of php 3 it was supported, but maybe there's something extra to turn it on.

I use a DBI to connect to the database and I haven't had any problems before. I'm sure the code is right, but here it is for clarification.

function DBI ($db, $user, $password, $port=5432) {		$this->session = pg_connect("user=$user password=$password dbname=$db port=$port");	}

This is part of the constructor for the class of my DBI. the pg_connect is where it's giving me an error...so I just typed in pg_connect and threw that upon the server as well and it complained giving me the same error.

I also tossed in a
if(function_exists('pg_connect')){echo 'FUnction is available';}else{echo 'function is not available';}

I assume I used that right..was my first time ever using that function.

But I got a

function is not available

out of it. So it's looking to me like the function isn't available. Any ideas? Edited by minnieadkins (see edit history)

Share this post

Link to post
Share on other sites

As far as I know, Xisto does not offer PostgreSQL Database (I could be wrong), which is what pg_connect is used for. It does however support MySQL using mysql_connect.

If you check PHP's Information inside CPanel or creating a page containing this:

<?php phpinfo(); ?>

It should tell you whether PostgreSQL is installed or not.

Is there any specific reason why it has to be PostgreSQL? If it's not installed then I think many of the PostgreSQL only commands will not be available.



Share this post

Link to post
Share on other sites

I dont know if the hosting package matters but the package i have supports both databases Postgress and MySql so i check my cpanel to verify and it works fine, i can create databases, users, etc. Then i check the phpinfo() function and sorprise, Postgress support isnt installed, so i try to load it dynamically with the dl() function and this function is disabled for security reasons, so there are two problems here:

Php support for Postgress databases is not installed.

The order of the parameters are incorrect, check the function pg_connect:

int pg_connect ( string host, string port, string options, string tty, string dbname )

The solution, simply use MySql or if its absolutely necessary request the Postgress support of php.


Best regards,

Share this post

Link to post
Share on other sites

Thanks for the quick replies. Indeed, I have access to the postgres database as you do TavoxPeru. I'll probably make a post in the support section, but I need the support fairly soon. I need postgres to do the project. I already have the database in place on the server, but I can't access it from this server =).

I believe the arguments passed to the function should be correct, so I'm pretty sure it's just a support for the database problem.

Is there any specific reason why it has to be PostgreSQL?

For my senior project, the company that I work for has sponsored our group to do an online exiting survey. This survey will integrate with an existing postgres database, and since they will use postgres as their database once the survey is developed, that's what I need to use.
I need the flexibility of having schemas so I can dump a few of the tables I need to integrate with it into the testing server.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.