Solved

Fatal error: Call to undefined function pg_connect()

Posted on 2009-04-09
3
4,170 Views
Last Modified: 2013-12-13
Hi,
I wonder if you could please help.
I installed Debian 5 and setup postgresql and its working fine. But PHP is not working fine.
It does not recognise posgresql functions. Fatal error: Call to undefined function pg_connect()
I looked in etc/php5/config.d/php.ini and even added a line extention extension=pgsql.so and restarted. No difference. I also tryed phpinfo() and it displayed info apart from any thing with postgresql or pg. I tryed to down load php-pgsql but its already a package of debian 5. I am new to this and if you could please explain step by step that would be so nice.
Kind regards
Me
0
Comment
Question by:RaviOptics
3 Comments
 
LVL 10

Expert Comment

by:webwyzsystems
Comment Utility
As well as uncommenting the line in php.ini  you also need to copy php_pgsql.dll to somewhere in the PATH (example:  c:\winnt\system32). The php_pgsql.dll DLL should be in your PHP installation somewhere, you'll have to search for it.

You shouldn't ever need to ADD anything to the php.ini file. It has everything generally needed. You only need to uncomment the appropriate lines.
0
 
LVL 6

Accepted Solution

by:
karlwilbur earned 250 total points
Comment Utility
You will not need to worry about DLL files since you are not running on Windows. Debian's aptitude (or apt-get) should configure everything exactly as you need it.

If you had to add "extension=pgsql.so" then it was not installed correctly. Are you trying to use PHP as CGI, CLI or an Apache module?

Assuming Apache module, you should see a file "/etc/php5/apache2/conf.d/pgsql.ini" This file would contain the "extension" directive. (this is Debian and Ubuntu specific...not to be assumed for other Linux flavors, MasOS or Windows)

If that file is missing, try this and tell me what you get:

sudo aptitude install php5-pgsql

Open in new window

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now