Thread: Can't Get PHP Going on PostgreSQL
I am new to both PHP and PostgreSQL. Trying to install PHP and PostgreSQL 8.0 on Slackware Linux 10.0.0 . I am getting the following error out of Apache: "Fatal Error: Call to undefined function: pg_connect() ...." PostgreSQL is up and running, and appears to be fine. Have found a lot of web references to this; the best was http://us2.php.net/pgsql . But am unable to proceed because I am not sure what to do. Facts about what I have installed: - Installed PHP from Slackware binary; I made no special efforts to compile it. According to a PHP utility function (phpinfo()), looks like it might be configured for MySQL already. - version info: PHP = 4.3.7 Linux kernel = 2.4.26 Apache = 1.3.31 How do I find these functions and install OR configure the php.ini file? I don't think this is hard to fix, but it is beating me up right now. What I need to find a blow-by-blow of what to do. Can somebody help me?
Your php install doesn't know about (or can't find) the postgresql extension. Default installs don't usually include postgresql support I think. run this command ldd /usr/local/apache/libexec/libphp4.so where the second parameter is the location of your php module for apache. This will list the shared object files that php needs. If you don't see a line like this libpq.so.3 => /usr/lib/libpq.so.3 (0x4001b000) then php was not compiled to include postgresql. Thom Dyson Director of Information Services Sybex, Inc. pgsql-php-owner@postgresql.org wrote on 03/10/2005 01:08:47 PM: > I am new to both PHP and PostgreSQL. Trying to install PHP and > PostgreSQL 8.0 on Slackware Linux 10.0.0 . > I am getting the following error out of Apache: > "Fatal Error: Call to undefined function: pg_connect() ...." > PostgreSQL is up and running, and appears to be fine.
PgSQL support isn't compiled into that. You can make a script like <?php phpinfo(); ?> to output what support is compiled in. Your best bet will to be to download the php source and compile it in yourself, unless there is a pgsql module laying around. I switched from slack a few years back so I'm not sure what they're doing with the php package these days. If you decide to compile it from source, just do a ./configure --with-pgsql (and other options you want/need) and --with-apxs and that should get you what you need. Good luck :) Gavin On Thu, 2005-03-10 at 16:08 -0500, Van Ingen, Lane wrote: > I am new to both PHP and PostgreSQL. Trying to install PHP and PostgreSQL 8.0 on Slackware Linux 10.0.0 . > I am getting the following error out of Apache: > "Fatal Error: Call to undefined function: pg_connect() ...." > > PostgreSQL is up and running, and appears to be fine. > > Have found a lot of web references to this; the best was http://us2.php.net/pgsql . But am unable > to proceed because I am not sure what to do. > > Facts about what I have installed: > - Installed PHP from Slackware binary; I made no special efforts to compile it. According to a PHP utility > function (phpinfo()), looks like it might be configured for MySQL already. > - version info: > PHP = 4.3.7 > Linux kernel = 2.4.26 > Apache = 1.3.31 > > How do I find these functions and install OR configure the php.ini file? > > I don't think this is hard to fix, but it is beating me up right now. What I need to find a blow-by-blow of > what to do. Can somebody help me? > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster
On Thu, 2005-03-10 at 16:08 -0500, Van Ingen, Lane wrote: > I am new to both PHP and PostgreSQL. Trying to install PHP and PostgreSQL 8.0 on Slackware Linux 10.0.0 . > I am getting the following error out of Apache: > "Fatal Error: Call to undefined function: pg_connect() ...." > > PostgreSQL is up and running, and appears to be fine. > > Have found a lot of web references to this; the best was http://us2.php.net/pgsql . But am unable > to proceed because I am not sure what to do. > > Facts about what I have installed: > - Installed PHP from Slackware binary; I made no special efforts to compile it. According to a PHP utility > function (phpinfo()), looks like it might be configured for MySQL already. > - version info: > PHP = 4.3.7 > Linux kernel = 2.4.26 > Apache = 1.3.31 > > How do I find these functions and install OR configure the php.ini file? > > I don't think this is hard to fix, but it is beating me up right now. What I need to find a blow-by-blow of > what to do. Can somebody help me? You need to install with pgsql support. in your configure: ./configure ... --with-pgsql -Robby -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | robby@planetargon.com * 503.351.4730 | blog.planetargon.com * PHP-PostgreSQL Hosting & Development * open source solutions - web hosting ****************************************/
I did a find, and found I have several configuration programs on the system. Assume that since I am configuring PHP, that should be in a PHP directory. Most likely was /usr/share/libtool/libltdl/configure, but am not sure of that. Also, what (files) does it require to do its 'configure', if any? -----Original Message----- From: Robby Russell [mailto:robby@planetargon.com] Sent: Thu 3/10/2005 9:00 PM To: Van Ingen, Lane Cc: pgsql-php@postgresql.org Subject: Re: [PHP] Can't Get PHP Going on PostgreSQL On Thu, 2005-03-10 at 16:08 -0500, Van Ingen, Lane wrote: > I am new to both PHP and PostgreSQL. Trying to install PHP and PostgreSQL 8.0 on Slackware Linux 10.0.0 . > I am getting the following error out of Apache: > "Fatal Error: Call to undefined function: pg_connect() ...." > > PostgreSQL is up and running, and appears to be fine. > > Have found a lot of web references to this; the best was http://us2.php.net/pgsql . But am unable > to proceed because I am not sure what to do. > > Facts about what I have installed: > - Installed PHP from Slackware binary; I made no special efforts to compile it. According to a PHP utility > function (phpinfo()), looks like it might be configured for MySQL already. > - version info: > PHP = 4.3.7 > Linux kernel = 2.4.26 > Apache = 1.3.31 > > How do I find these functions and install OR configure the php.ini file? > > I don't think this is hard to fix, but it is beating me up right now. What I need to find a blow-by-blow of > what to do. Can somebody help me? You need to install with pgsql support. in your configure: ./configure ... --with-pgsql -Robby -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | robby@planetargon.com * 503.351.4730 | blog.planetargon.com * PHP-PostgreSQL Hosting & Development * open source solutions - web hosting ****************************************/
Van Ingen, Lane wrote: > I did a find, and found I have several configuration programs on the system. Assume that since I am > configuring PHP, that should be in a PHP directory. Most likely was /usr/share/libtool/libltdl/configure, > but am not sure of that. > > Also, what (files) does it require to do its 'configure', if any? > How did you install PHP in the first place? If your using Linux and you used your distributions package system, it's fairly likely that there will be a php module for postggresql in your package system as well. F.ex. on debian it's "apt-get install php4-pgsql" which will install the module, and activate support for it. What distribution/os are you using? Tommy