0

I have been using Wamp server for a long time now. It comes with MySQL. Today I had to change from mysql to PostgreSQL. I've tried install Postgres, downloaded and completed the installation. But when I tried to run a php program to reteive some data from the table,

<?php
$link = pg_connect("host=192.168.2.43 dbname=DataFetcher user=postgres password=user");
echo "Connection Established";
?>

it says Call to undefined function pg_connect(), that means Postgres is not detected.

What could be the issue?

5
  • Was your PHP version built with Postgresql support? Check phpinfo() and have a look at php.net/manual/en/pgsql.installation.php. Commented May 31, 2012 at 10:17
  • Can you connect to Postgres using it's commandline tool psql? Commented May 31, 2012 at 10:50
  • no..Im a starter in postgres, I was trying to install it and wnt to know mre abt it by using it..bt I cnt get this thing started Commented May 31, 2012 at 10:54
  • What happens when you try to connect throuh psql Commented May 31, 2012 at 11:38
  • possible duplicate of PostgreSQL with wamp Commented Jun 1, 2012 at 8:05

2 Answers 2

1

You need to enable the extention.

Something like left click wamp icon goto - php > extentions and click php_pgsql.

Sign up to request clarification or add additional context in comments.

10 Comments

should I disable anything related to mysql?
@user1371896 Have you restarted the server?
@user1371896 No, it has nothing related with mysql.
anything to be changed in the file php.ini
This is fairly clearly an issue with not having the extension. Create a page containing just <?php phpinfo(); ?>. This will let you view your PHP setup. If the extension doesn't get listed on the resulting page, then its not installed correctly. This isn't a problem with postgresql and definitely not mysql.
|
0

I had the same issue. I installed wamp, enabled php_pgsql and php_pdo_pgsql successfully. But I was still unable to see pgsql installed on apache server. I found a nice explanation and solution provided by @skoobiedu at http://forum.wampserver.com/read.php?2,40270,40311

P.S. I have again given this answer because this is the correct answer for this question and @Bill deleted my answer. I request @user1371896 to accept this answer as correct answer. I also request @bill not to delete this answer as I have already removed same answer from one other post.

1 Comment

I had given same answer on one more posted question. So he deleted my answer. I didn't know that we can't give same answers to different posts. Actually i should have given you the link to the duplicate answer. And by the way now i have deleted the duplicate answer. now this is the only answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.