PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34 PROBLEM!!PLEASE HELP

PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34 PROBLEM!!PLEASE HELP

am 27.04.2006 09:02:31 von belfegor666

Help! I was trying to make an installation of PHP 5.1.2 + Apache
2.0.55 + PostgreSQL 8.1 on Windows 2003 Server, and I'm stuck. I
got PHP to work with Apache quite smoothly, so did I marry PHP with
PostgreSQL - scripts connecting to the database work fine from
windows command line, except that the following code:

if (extension_loaded("php_pgsql")) {
echo "PGSQL loaded!";
}

returns no message. Still database queries work fine. Trouble starts
when I try to open a page in my browser - then I get an error
message like this:

Error: call to udefined function pg_connect()...

I changed the php.ini file a billion times, trying to figure out
what to set in the "extension_dir" and "extension=3Dphp_pgsql.dll"
lines, and I tried at least as many times to change apache's
httpd.conf file so that the php module is loaded properly. And it
is, as far as I'm concerned - the phpinfo() page shows without a
problem. One peculiar thing about it is that in the "Loaded
modules" section (don't remember the exact name) there's absolutely
no sign of the pgsql module.

I also tried downloading and installing the latest php snapshot,
because someone on a forum told me it might work, but it didn't :o(
I even tried earlier versions of Apache and PHP, but nothing
worked. Initially I figured I must have found a bug, but I don't
really believe it could've gone on for so long without being
noticed by somebody...

I'm begging for help, because the person I'm doing the server for
strongly insists on the machine working on Win 2003 and not some
distribution of linux or unix.

Regards,
krzysieq


--=20
Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie drobne do "Ga=
zety Wyborczej" przez internet wchodzac na http://www.aaaby.pl/wyborcza i=
wygraj nawet 10.000 zl!

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Re: PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34 PROBLEM!! PLEASE HELP

am 27.04.2006 10:46:58 von Chris Smith

On 4/27/06, belfegor666@gazeta.pl wrote:
> Help! I was trying to make an installation of PHP 5.1.2 + Apache
> 2.0.55 + PostgreSQL 8.1 on Windows 2003 Server, and I'm stuck. I
> got PHP to work with Apache quite smoothly, so did I marry PHP with
> PostgreSQL - scripts connecting to the database work fine from
> windows command line, except that the following code:
>
> if (extension_loaded("php_pgsql")) {
> echo "PGSQL loaded!";
> }
>
> returns no message. Still database queries work fine. Trouble starts
> when I try to open a page in my browser - then I get an error
> message like this:
>
> Error: call to udefined function pg_connect()...
>
> I changed the php.ini file a billion times, trying to figure out
> what to set in the "extension_dir" and "extension=3Dphp_pgsql.dll"
> lines, and I tried at least as many times to change apache's
> httpd.conf file so that the php module is loaded properly. And it
> is, as far as I'm concerned - the phpinfo() page shows without a
> problem. One peculiar thing about it is that in the "Loaded
> modules" section (don't remember the exact name) there's absolutely
> no sign of the pgsql module.

Copied straight from my reply on the general list.

you could change the first check to:

if (!function_exists('pg_connect')) {
die("no pg_connect");
}

What does:

print_r(get_loaded_extensions());

show?

Anything regarding pgsql?

Does your server keep logs? Maybe something in there will give you
some ideas about what's going on..

--
Postgresql & php tutorials
http://www.designmagick.com/

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Re: PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34 PROBLEM!! PLEASE HELP

am 27.04.2006 10:48:31 von Neil Saunders

Ok, not to worry, first of all, look at the output to phpinfo() again.
Look in the top section for the "Configuration File (php.ini) Path";
in my case, "C:\WINDOWS\php.ini". Ensure that this is the one you're
editting. If it isn't, thats your problem. If it is...

Your "extension_dir" setting should be your php folder with "/ext"
tabbed on the end, so in my case:

extension_dir =3D "c:/php/ext/"

Note the forward slashes.

Next, ensure that "php_pgsql.dll" exists in the c:\php\ext directory,
and then check that the following exists in the dynamic extensions
section:

extension=3Dphp_pgsql.dll

I'd bet you're just editting the wrong php.ini - Been there, done that :)

Neil.

On 4/27/06, belfegor666@gazeta.pl wrote:
> Help! I was trying to make an installation of PHP 5.1.2 + Apache
> 2.0.55 + PostgreSQL 8.1 on Windows 2003 Server, and I'm stuck. I
> got PHP to work with Apache quite smoothly, so did I marry PHP with
> PostgreSQL - scripts connecting to the database work fine from
> windows command line, except that the following code:
>
> if (extension_loaded("php_pgsql")) {
> echo "PGSQL loaded!";
> }
>
> returns no message. Still database queries work fine. Trouble starts
> when I try to open a page in my browser - then I get an error
> message like this:
>
> Error: call to udefined function pg_connect()...
>
> I changed the php.ini file a billion times, trying to figure out
> what to set in the "extension_dir" and "extension=3Dphp_pgsql.dll"
> lines, and I tried at least as many times to change apache's
> httpd.conf file so that the php module is loaded properly. And it
> is, as far as I'm concerned - the phpinfo() page shows without a
> problem. One peculiar thing about it is that in the "Loaded
> modules" section (don't remember the exact name) there's absolutely
> no sign of the pgsql module.
>
> I also tried downloading and installing the latest php snapshot,
> because someone on a forum told me it might work, but it didn't :o(
> I even tried earlier versions of Apache and PHP, but nothing
> worked. Initially I figured I must have found a bug, but I don't
> really believe it could've gone on for so long without being
> noticed by somebody...
>
> I'm begging for help, because the person I'm doing the server for
> strongly insists on the machine working on Win 2003 and not some
> distribution of linux or unix.
>
> Regards,
> krzysieq
>
>
> --
> Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie drobne do "Ga=
zety Wyborczej" przez internet wchodzac na http://www.aaaby.pl/wyborcza i w=
ygraj nawet 10.000 zl!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Re: PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34

am 27.04.2006 17:37:26 von belfegor666

> Help! I was trying to make an installation of PHP 5.1.2 + Apache
> 2.0.55 + PostgreSQL 8.1 on Windows 2003 Server, and I'm stuck. I
> got PHP to work with Apache quite smoothly, so did I marry PHP=20
> with PostgreSQL - scripts connecting to the database work fine=20
> from windows command line, except that the following code:
>
> if (extension_loaded("php_pgsql")) {
> echo "PGSQL loaded!";
> }
>
> returns no message. Still database queries work fine. Trouble=20
> starts
> when I try to open a page in my browser - then I get an error
> message like this:
>
> Error: call to udefined function pg_connect()...
>
> I changed the php.ini file a billion times, trying to figure out
> what to set in the "extension_dir" and "extension=3Dphp_pgsql.dll"
> lines, and I tried at least as many times to change apache's
> httpd.conf file so that the php module is loaded properly. And it
> is, as far as I'm concerned - the phpinfo() page shows without a
> problem. One peculiar thing about it is that in the "Loaded
> modules" section (don't remember the exact name) there's=20
> absolutely no sign of the pgsql module.

>>you could change the first check to:
>>if (!function_exists('pg_connect')) {
>> die("no pg_connect");
>>}

I did. I got the message "no pg_connect", as You had probably=20
expected...

>>What does:
>>
>>print_r(get_loaded_extensions());
>>
>>show?
>>
>>Anything regarding pgsql?

Here's the output from both php4 and php5 on both Apache 1.3.45 and=20
2.0.55:

Array ( [0] =3D> standard [1] =3D> bcmath [2] =3D> calendar [3] =3D> ctyp=
e=20
[4] =3D> com [5] =3D> ftp [6] =3D> mysql [7] =3D> odbc [8] =3D> overload =
[9]=20
=3D> pcre [10] =3D> session [11] =3D> tokenizer [12] =3D> xml [13] =3D> w=
ddx=20
[14] =3D> zlib [15] =3D> apache )=20

Actually, it used to be like what's written above, but suddenly it=20
changed to this and is still like it, no matter what I do:

Array ( [0] =3D> bcmath [1] =3D> calendar [2] =3D> com_dotnet [3] =3D>=20
ctype [4] =3D> date [5] =3D> ftp [6] =3D> hash [7] =3D> iconv [8] =3D> od=
bc=20
[9] =3D> pcre [10] =3D> Reflection [11] =3D> session [12] =3D> libxml [13=
]=20
=3D> standard [14] =3D> tokenizer [15] =3D> zlib [16] =3D> SimpleXML [17]=
=20
=3D> dom [18] =3D> SPL [19] =3D> wddx [20] =3D> xml [21] =3D> xmlreader [=
22]=20
=3D> xmlwriter [23] =3D> apache2handler )=20

>>Does your server keep logs? Maybe something in there will give you
>>some ideas about what's going on..

Inside error.log I found the following line (a number of times,=20
probably because I was often changing httpd.conf and restarting the=20
server):

PHP Warning: PHP Startup: Unable to load dynamic=20
library './ext/php_pgsql.dll' - Unable to locate specified module=20
in Unknown on line 0

(This might not be the exact message as I was translating the part=20
after "-" from my native language, which is Polish.=20

By the way, here's some more detailed info about my installation:
PHP4 directory: C:\PHP4 (extensions in C:\PHP4\extensions)
PHP5 directory: C:\PHP5 (extensions in C:\PHP5\ext)
Apache 1.3.34 directory: C:\Program Files\Apache Group\Apache
Apache 2.0.55 directory: C:\Program Files\Apache Group\Apache2

The following comments will relate to PHP5 + Apache2 configuration=20
files. I tried the same things with other combinations of php and=20
apache versions with the same result (i.e. no result). All of these=20
lines are uncommented.

php.ini (located in C:\PHP5\php.ini)
doc_root=3D
user_dir=3D
extension_dir=3D"C:/PHP5/ext/" (also tried "./ext", "C:\PHP5\ext")
....
extension=3Dphp_pgsql.dll

httpd.conf (located in ...Apache2\conf\httpd.conf)
UserDir "D:/WWW/*"
DirectoryIndex index.php index.htm index.html index.html.var
LoadModule php5_module "C:\PHP5\php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir "C:\PHP5\"


--=20
Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie drobne do "Ga=
zety Wyborczej" przez internet wchodzac na http://www.aaaby.pl/wyborcza i=
wygraj nawet 10.000 zl!

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34

am 27.04.2006 17:59:23 von belfegor666

>> Ok, not to worry, first of all, look at the output to phpinfo()=20
>> again. Look in the top section for the "Configuration File=20
>>(php.ini) Path";
>> in my case, "C:\WINDOWS\php.ini". Ensure that this is the one=20
>> you're editting. If it isn't, thats your problem. If it is...

It actually is "C:\WINDOWS" (not C:\WINDOWS\php.ini), but the file=20
wasn't there. I copied it and adjusted so that the relevant lines=20
match the new location. Still no effect.

>> Your "extension_dir" setting should be your php folder=20
>> with "/ext" tabbed on the end, so in my case:
>>
>>extension_dir =3D "c:/php/ext/"
>>
>>Note the forward slashes.

Done. It is: "c:/php5/ext/". I also tried "C:/PHP5/ext/" and the=20
same with backslashes. No effect.=20

>> Next, ensure that "php_pgsql.dll" exists in the c:\php\ext =20
>> directory, and then check that the following exists in the=20
>> dynamic extensions section:
>>
>> extension=3Dphp_pgsql.dll

Done. It's there, all right.=20

>>
>> I'd bet you're just editting the wrong php.ini - Been there,=20
>> done that :)

I probably was. Unfortunately, editing the right one (which was=20
missing, by the way) didn't do me no good. Any other ideas, what=20
might I be doing wrong?

>>
>> Neil.

Thanks,
Chris.

On 4/27/06, belfegor666@gazeta.pl wrote:
> Help! I was trying to make an installation of PHP 5.1.2 + Apache
> 2.0.55 + PostgreSQL 8.1 on Windows 2003 Server, and I'm stuck. I
> got PHP to work with Apache quite smoothly, so did I marry PHP=20
with
> PostgreSQL - scripts connecting to the database work fine from
> windows command line, except that the following code:
>
> if (extension_loaded("php_pgsql")) {
> echo "PGSQL loaded!";
> }
>
> returns no message. Still database queries work fine. Trouble=20
starts
> when I try to open a page in my browser - then I get an error
> message like this:
>
> Error: call to udefined function pg_connect()...
>
> I changed the php.ini file a billion times, trying to figure out
> what to set in the "extension_dir" and "extension=3Dphp_pgsql.dll"
> lines, and I tried at least as many times to change apache's
> httpd.conf file so that the php module is loaded properly. And it
> is, as far as I'm concerned - the phpinfo() page shows without a
> problem. One peculiar thing about it is that in the "Loaded
> modules" section (don't remember the exact name) there's=20
absolutely
> no sign of the pgsql module.
>
> I also tried downloading and installing the latest php snapshot,
> because someone on a forum told me it might work, but it didn't :o
(
> I even tried earlier versions of Apache and PHP, but nothing
> worked. Initially I figured I must have found a bug, but I don't
> really believe it could've gone on for so long without being
> noticed by somebody...
>
> I'm begging for help, because the person I'm doing the server for
> strongly insists on the machine working on Win 2003 and not some
> distribution of linux or unix.
>
> Regards,
> krzysieq
>
>
> --
> Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie=20
drobne do "Gazety Wyborczej" przez internet wchodzac na=20
http://www.aaaby.pl/wyborcza i wygraj nawet 10.000 zl!
>
> ---------------------------(end of broadcast)---------------------
------
> TIP 9: In versions below 8.0, the planner will ignore your desire=20
to
> choose an index scan if your joining column's datatypes do=20
not
> match
>




--=20
Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie drobne do "Ga=
zety Wyborczej" przez internet wchodzac na http://www.aaaby.pl/wyborcza i=
wygraj nawet 10.000 zl!

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Re: PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34

am 27.04.2006 20:01:17 von operationsengineer1

> I probably was. Unfortunately, editing the right one
> (which was=20
> missing, by the way) didn't do me no good. Any other
> ideas, what=20
> might I be doing wrong?
>=20
> >>
> >> Neil.
>=20
> Thanks,
> Chris.

1. did you rrestart apache before checking if anything
changed?
2. check this link for throough instructions how to
get everything working - it works on xp home since
i've done it twice. my guess is works on 2003, too.

http://www.geocities.com/operationsengineer1/

is php_pgsql.dll showing up as installed when you run
phpinfo()? it could be that your php.ini file isn't
being read. i have instructions for how to set up an
environment variable that will automatically read
php.ini in the php set of instructions (i think - it
is one of the three).

good luck.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around=20
http://mail.yahoo.com=20

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Re: PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34

am 30.04.2006 15:53:56 von belfegor666

Thanks for help, everyone :o) I finally got it working. Here's how I
did it, by the way, if enyone encounters the same problem.

It turned out I actually was editing the wrong php.ini, since the one
in my c:\php5 folder was never even read by apache. This is odd
because I checked a thousand times, and I bet my ass I had the
PHPIniDir directive set to C:\php5 in my httpd.conf. I tried various
approaches to this - forward slash, trailing slash, moving the php
directory somewhere else - nothing. php.ini would always be looked for
in c:\windows directory, nowhere else. Seems as though Windows knows
better where to look for this file than apache itself, because the
phpinfo() would show that php.ini was in c:\windows :o[[

Everything works pretty neat right now. Thanks for help again
Chris

Thursday, April 27, 2006, 8:01:17 PM, you wrote:

>> I probably was. Unfortunately, editing the right one
>> (which was
>> missing, by the way) didn't do me no good. Any other
>> ideas, what
>> might I be doing wrong?
>>
>> >>
>> >> Neil.
>>
>> Thanks,
>> Chris.

oyc> 1. did you rrestart apache before checking if anything
oyc> changed?
oyc> 2. check this link for throough instructions how to
oyc> get everything working - it works on xp home since
oyc> i've done it twice. my guess is works on 2003, too.

oyc> http://www.geocities.com/operationsengineer1/

oyc> is php_pgsql.dll showing up as installed when you run
oyc> phpinfo()? it could be that your php.ini file isn't
oyc> being read. i have instructions for how to set up an
oyc> environment variable that will automatically read
oyc> php.ini in the php set of instructions (i think - it
oyc> is one of the three).

oyc> good luck.

oyc> __________________________________________________
oyc> Do You Yahoo!?
oyc> Tired of spam? Yahoo! Mail has the best spam protection around
oyc> http://mail.yahoo.com

oyc> ---------------------------(end of
oyc> broadcast)---------------------------
oyc> TIP 2: Don't 'kill -9' the postmaster

oyc> --

oyc> Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie
oyc> drobne do "Gazety Wyborczej" przez internet wchodzac na
oyc> http://www.aaaby.pl/wyborcza i wygraj nawet 10.000 zl!


oyc> ---
oyc> avast! antivirus: Incoming message clean.
oyc> Virus signature database (VPS): 0617-3, 2006-04-28
oyc> Tested on: 2006-04-30 15:38:14
oyc> avast! - Copyright (c) 1988-2006 ALWIL Software.
oyc> http://www.avast.com





mailto:belfegor666@gazeta.pl



---
avast! antivirus: Outgoing message clean.
Virus signature database (VPS): 0617-3, 2006-04-28
Tested on: 2006-04-30 15:54:00
avast! - Copyright (c) 1988-2006 ALWIL Software.
http://www.avast.com




--
Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie drobne do "Gazety Wyborczej" przez internet wchodzac na http://www.aaaby.pl/wyborcza i wygraj nawet 10.000 zl!

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org