Thread: Changes in 8.2's PHP behaviour?

Changes in 8.2's PHP behaviour?

From
"semi-ambivalent"
Date:
All,

I have a simple web page that inserts data into a table in 8.1.5 using
PHP4. It's pretty amateurish but gets the job done. A few days ago I
upgraded to 8.2 (this is on a FreeBSD system, and I used the port) but
when I tried to use the web page this morning I got errors about:

PHP Fatal error:  Call to undefined function:  pg_escape_string() in
/usr/local/www/data-dist/some_dir/some_dir/dataInsert.php on line 9,
referer: http://localhost/some_dir/some_dir/dataEnter.php

I'm a pretty poor PHP person, and I think its error messages can be
cryptic, but nothing has changed in this except the version of
postgresql. Does 8.2 handle input differently than does 8.1.x? Is that
where to begin looking? I have seen talk about handling of escape
strings but thought is was 'this way is good and this way is bad' kind
of thing, not a 'this way will no longer work with postgresql' thing.
FWIW a quick pg_dump, a fallback to 8.1.5 and a restore and things work
again.

thanks for any pointers,

r


Re: Changes in 8.2's PHP behaviour?

From
Erik Jones
Date:
You probably need to re-compile PHP so that it can correctly link to the
new postgres binaries.

semi-ambivalent wrote:
> All,
>
> I have a simple web page that inserts data into a table in 8.1.5 using
> PHP4. It's pretty amateurish but gets the job done. A few days ago I
> upgraded to 8.2 (this is on a FreeBSD system, and I used the port) but
> when I tried to use the web page this morning I got errors about:
>
> PHP Fatal error:  Call to undefined function:  pg_escape_string() in
> /usr/local/www/data-dist/some_dir/some_dir/dataInsert.php on line 9,
> referer: http://localhost/some_dir/some_dir/dataEnter.php
>
> I'm a pretty poor PHP person, and I think its error messages can be
> cryptic, but nothing has changed in this except the version of
> postgresql. Does 8.2 handle input differently than does 8.1.x? Is that
> where to begin looking? I have seen talk about handling of escape
> strings but thought is was 'this way is good and this way is bad' kind
> of thing, not a 'this way will no longer work with postgresql' thing.
> FWIW a quick pg_dump, a fallback to 8.1.5 and a restore and things work
> again.
>
> thanks for any pointers,
>
> r
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org/
>


--
erik jones <erik@myemma.com>
software development
emma(r)


Re: Changes in 8.2's PHP behaviour?

From
Chris
Date:
semi-ambivalent wrote:
> All,
>
> I have a simple web page that inserts data into a table in 8.1.5 using
> PHP4. It's pretty amateurish but gets the job done. A few days ago I
> upgraded to 8.2 (this is on a FreeBSD system, and I used the port) but
> when I tried to use the web page this morning I got errors about:
>
> PHP Fatal error:  Call to undefined function:  pg_escape_string() in
> /usr/local/www/data-dist/some_dir/some_dir/dataInsert.php on line 9,
> referer: http://localhost/some_dir/some_dir/dataEnter.php

That means that the 'pg_escape_string' function doesn't exist (it's not
*that* cryptic). Do you have postgres support in php?

Create a php info page:

<?php
phpinfo();
?>

view it in a browser... there should be a big "postgresql" section - if
there isn't, that's the problem..

As others have suggested, maybe you need to update the php-pgsql library
as well.

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

Re: Changes in 8.2's PHP behaviour?

From
Marcus Engene
Date:
semi-ambivalent skrev:
> All,
>
> I have a simple web page that inserts data into a table in 8.1.5 using
> PHP4. It's pretty amateurish but gets the job done. A few days ago I
> upgraded to 8.2 (this is on a FreeBSD system, and I used the port) but
> when I tried to use the web page this morning I got errors about:
>
> PHP Fatal error:  Call to undefined function:  pg_escape_string() in
> /usr/local/www/data-dist/some_dir/some_dir/dataInsert.php on line 9,
> referer: http://localhost/some_dir/some_dir/dataEnter.php
>
> I'm a pretty poor PHP person, and I think its error messages can be
> cryptic, but nothing has changed in this except the version of
> postgresql. Does 8.2 handle input differently than does 8.1.x? Is that
> where to begin looking? I have seen talk about handling of escape
> strings but thought is was 'this way is good and this way is bad' kind
> of thing, not a 'this way will no longer work with postgresql' thing.
> FWIW a quick pg_dump, a fallback to 8.1.5 and a restore and things work
> again.
>
> thanks for any pointers,
>
> r

If a recompile of php is necessary perhaps you might want to consider
php 5.1 in which a kind soul implemented support for bind variables.

http://ch2.php.net/manual/en/function.pg-query-params.php

Best regards,
Marcus


Re: Changes in 8.2's PHP behaviour?

From
"semi-ambivalent"
Date:
Erik Jones wrote:
> You probably need to re-compile PHP so that it can correctly link to the
> new postgres binaries.
>
> semi-ambivalent wrote:
> > All,
> >
> > I have a simple web page that inserts data into a table in 8.1.5 using
> > PHP4. It's pretty amateurish but gets the job done. A few days ago I
> > upgraded to 8.2 (this is on a FreeBSD system, and I used the port) but
> > when I tried to use the web page this morning I got errors about:
> >
> > PHP Fatal error:  Call to undefined function:  pg_escape_string() in
> > /usr/local/www/data-dist/some_dir/some_dir/dataInsert.php on line 9,
> > referer: http://localhost/some_dir/some_dir/dataEnter.php
> >
> > I'm a pretty poor PHP person, and I think its error messages can be
> > cryptic, but nothing has changed in this except the version of
> > postgresql. Does 8.2 handle input differently than does 8.1.x? Is that
> > where to begin looking? I have seen talk about handling of escape
> > strings but thought is was 'this way is good and this way is bad' kind
> > of thing, not a 'this way will no longer work with postgresql' thing.
> > FWIW a quick pg_dump, a fallback to 8.1.5 and a restore and things work
> > again.
> >
> > thanks for any pointers,
> >
> > r
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> >                http://archives.postgresql.org/
> >
>
>
> --
> erik jones <erik@myemma.com>
> software development
> emma(r)
>
>
> ---------------------------(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


!   :)

thanks (both)

s-a