Some undefined function errors

Started by Giancarlo Boaronalmost 16 years ago9 messagesgeneral
Jump to latest
#1Giancarlo Boaron
gboaron@yahoo.com.br

Hi all.

Recently, I wrote an email about the problem I was having with some Postgres functions that when those functions were called, I received the following error: "Call to undefined function <function_name>".

After some answers, I decided to rebuild a brand new linux virtual machine with Apache + PHP + Postgres, but I still get this annoying error messege with some functions like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with --with-apxs2=/usr/local/apache2/bin/apxs and --with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something in php_config.h file? If so, what do I have to change?

Thank you.

#2Fernando
fernando@ggtours.ca
In reply to: Giancarlo Boaron (#1)
Re: [PHP] Some undefined function errors

Are you calling store procedures that return cursors? I had this
problem with cursors because the transaction gets committed and the
cursor closed after they return. Mind you I had the problem on .NET
using npgsql, so I might be way off.

Cheers

Show quoted text

On 20/05/2010 10:05, Giancarlo Boaron wrote:

Hi all.

Recently, I wrote an email about the problem I was having with some Postgres functions that when those functions were called, I received the following error: "Call to undefined function<function_name>".

After some answers, I decided to rebuild a brand new linux virtual machine with Apache + PHP + Postgres, but I still get this annoying error messege with some functions like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with --with-apxs2=/usr/local/apache2/bin/apxs and --with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something in php_config.h file? If so, what do I have to change?

Thank you.

#3Giancarlo Boaron
gboaron@yahoo.com.br
In reply to: Fernando (#2)
Re: [PHP] Some undefined function errors

I make the function call in a php file. I'm not using stored procedures.
 
If I create an empty php file and put only some of these functions, Apache reports de 'call to undefined function XXX'.

--- Em qui, 20/5/10, Fernando <fernando@ggtours.ca> escreveu:

De: Fernando <fernando@ggtours.ca>
Assunto: Re: [GENERAL] [PHP] Some undefined function errors
Para: pgsql-general@postgresql.org
Data: Quinta-feira, 20 de Maio de 2010, 11:25

Are you calling store procedures that return cursors?  I had this problem with cursors because the transaction gets committed and the cursor closed after they return.  Mind you I had the problem on .NET using npgsql, so I might be way off.

Cheers

On 20/05/2010 10:05, Giancarlo Boaron wrote:
Hi all.

Recently, I wrote an email about the problem I was having with some Postgres functions that when those functions were called, I received the following error: "Call to undefined function <function_name>".

After some answers, I decided to rebuild a brand new linux virtual machine with Apache + PHP + Postgres, but I still get this annoying error messege with some functions like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with --with-apxs2=/usr/local/apache2/bin/apxs and --with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something in php_config.h file? If so, what do I have to change?

Thank you.

#4Fernando
fernando@ggtours.ca
In reply to: Giancarlo Boaron (#3)
Re: [PHP] Some undefined function errors

Sorry I miss read the question.

It does seem that php is not picking up the pg module and cannot find
the functions.

I assume Postgresql is in fact installed at /usr/local/pgsql. If you
run phpinfo(); can you see that PG is installed?

Show quoted text

On 20/05/2010 10:46, Giancarlo Boaron wrote:

**
I make the function call in a php file. I'm not using stored procedures.
If I create an empty php file and put only some of these functions,
Apache reports de 'call to undefined function XXX'.

--- Em *qui, 20/5/10, Fernando /<fernando@ggtours.ca>/* escreveu:

De: Fernando <fernando@ggtours.ca>
Assunto: Re: [GENERAL] [PHP] Some undefined function errors
Para: pgsql-general@postgresql.org
Data: Quinta-feira, 20 de Maio de 2010, 11:25

Are you calling store procedures that return cursors? I had this
problem with cursors because the transaction gets committed and
the cursor closed after they return. Mind you I had the problem
on .NET using npgsql, so I might be way off.

Cheers

On 20/05/2010 10:05, Giancarlo Boaron wrote:

Hi all.

Recently, I wrote an email about the problem I was having with some Postgres functions that when those functions were called, I received the following error: "Call to undefined function<function_name>".

After some answers, I decided to rebuild a brand new linux virtual machine with Apache + PHP + Postgres, but I still get this annoying error messege with some functions like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with --with-apxs2=/usr/local/apache2/bin/apxs and --with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something in php_config.h file? If so, what do I have to change?

Thank you.

#5Jim Lucas
lists@cmsws.com
In reply to: Giancarlo Boaron (#1)
Re: [PHP] Some undefined function errors

Giancarlo Boaron wrote:

Hi all.

Recently, I wrote an email about the problem I was having with some Postgres functions that when those functions were called, I received the following error: "Call to undefined function <function_name>".

After some answers, I decided to rebuild a brand new linux virtual machine with Apache + PHP + Postgres, but I still get this annoying error messege with some functions like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with --with-apxs2=/usr/local/apache2/bin/apxs and --with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something in php_config.h file? If so, what do I have to change?

Thank you.

Depending on what version of apache you are running, you need to make sure that
you are loading the pgsql.so file or have the psql.ini file in your
/var/www/conf/php5/ directory.

This way it knows to load pg.

--
Jim Lucas

"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

#6Giancarlo Boaron
gboaron@yahoo.com.br
In reply to: Jim Lucas (#5)
Re: [PHP] Some undefined function errors

Yes. Phpinfo() tells me it's ok:

pgsql
PostgreSQL Support enabled
PostgreSQL(libpq) Version 8.4.4
Multibyte character support disabled
SSL support enabled
Active Persistent Links 0
Active Links 0

Directive Local Value Master Value
pgsql.allow_persistent On On
pgsql.auto_reset_persistent Off Off
pgsql.ignore_notice Off Off
pgsql.log_notice Off Off
pgsql.max_links Unlimited Unlimited
pgsql.max_persistent Unlimited Unlimited

My PHP version is 5.3.2.
My PostgreSQL version is 8.4.4 and I'm running the server under the restrict 'postgres' user privileges since I can't run the daemon process as 'root'.

Thank you for some help.

--- Em qui, 20/5/10, Fernando <fernando@ggtours.ca> escreveu:
Show quoted text

De: Fernando <fernando@ggtours.ca>
Assunto: Re: [PHP] Some undefined function errors
Para: php-general@lists.php.net
Data: Quinta-feira, 20 de Maio de 2010, 12:23
  Sorry I miss read the
question.

It does seem that php is not picking up the pg module and
cannot find
the functions.

I assume Postgresql is in fact installed at
/usr/local/pgsql.  If you
run phpinfo(); can you see that PG is installed?

On 20/05/2010 10:46, Giancarlo Boaron wrote:

**
I make the function call in a php file. I'm not using

stored procedures.

If I create an empty php file and put only some of

these functions,

Apache reports de 'call to undefined function XXX'.

--- Em *qui, 20/5/10, Fernando /<fernando@ggtours.ca>/*

escreveu:

     De: Fernando <fernando@ggtours.ca>
     Assunto: Re: [GENERAL] [PHP]

Some undefined function errors

     Para: pgsql-general@postgresql.org
     Data: Quinta-feira, 20 de Maio

de 2010, 11:25

     Are you calling store

procedures that return cursors?  I had this

     problem with cursors because

the transaction gets committed and

     the cursor closed after they

return.  Mind you I had the problem

     on .NET using npgsql, so I

might be way off.

     Cheers

     On 20/05/2010 10:05, Giancarlo

Boaron wrote:

     Hi all.

     Recently, I wrote an email

about the problem I was having with some Postgres functions
that when those functions were called, I received the
following error: "Call to undefined
function<function_name>".

     After some answers, I

decided to rebuild a brand new linux virtual machine with
Apache + PHP + Postgres, but I still get this annoying error
messege with some functions like pg_prepare() and
pg_escape_string().

     I compiled Postgres with

--without-readline option.

     I compiled PHP with

--with-apxs2=/usr/local/apache2/bin/apxs and
--with-pgsql=/usr/local/pgsql/

     And the compilation

process has no errors.

     What am I doing wrong? Do

I have to change something in php_config.h file? If so, what
do I have to change?

     Thank you.

       

#7Giancarlo Boaron
gboaron@yahoo.com.br
In reply to: Jim Lucas (#5)
Re: [PHP] Some undefined function errors

Hi Jim.

I think it depends on each server configuration but I checked in my server and I don't have the 'pgsql.so' and 'psql.ini' files and neither the 'www' directory.

My Apache version is 2.2.15 and my root directory is /usr/local/apache2/htdocs.

Thank you.

--- Em qui, 20/5/10, Jim Lucas <lists@cmsws.com> escreveu:
Show quoted text

De: Jim Lucas <lists@cmsws.com>
Assunto: Re: [PHP] Some undefined function errors
Para: "Giancarlo Boaron" <gboaron@yahoo.com.br>
Cc: pgsql-general@postgresql.org, php-general@lists.php.net, pgsql-novice@postgresql.org
Data: Quinta-feira, 20 de Maio de 2010, 13:04
Giancarlo Boaron wrote:

Hi all.

Recently, I wrote an email about the problem I was

having with some Postgres functions that when those
functions were called, I received the following error: "Call
to undefined function <function_name>".

After some answers, I decided to rebuild a brand new

linux virtual machine with Apache + PHP + Postgres, but I
still get this annoying error messege with some functions
like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with

--with-apxs2=/usr/local/apache2/bin/apxs and
--with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something

in php_config.h file? If so, what do I have to change?

Thank you.

       

Depending on what version of apache you are running, you
need to make sure that
you are loading the pgsql.so file or have the psql.ini file
in your
/var/www/conf/php5/ directory.

This way it knows to load pg.

--
Jim Lucas

   "Some men are born to greatness, some
achieve greatness,
       and some have greatness
thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

#8Ashley Sheridan
ash@ashleysheridan.co.uk
In reply to: Giancarlo Boaron (#7)
Re: [PHP] Some undefined function errors

On Thu, 2010-05-20 at 09:21 -0700, Giancarlo Boaron wrote:

Hi Jim.

I think it depends on each server configuration but I checked in my server and I don't have the 'pgsql.so' and 'psql.ini' files and neither the 'www' directory.

My Apache version is 2.2.15 and my root directory is /usr/local/apache2/htdocs.

Thank you.

--- Em qui, 20/5/10, Jim Lucas <lists@cmsws.com> escreveu:

De: Jim Lucas <lists@cmsws.com>
Assunto: Re: [PHP] Some undefined function errors
Para: "Giancarlo Boaron" <gboaron@yahoo.com.br>
Cc: pgsql-general@postgresql.org, php-general@lists.php.net, pgsql-novice@postgresql.org
Data: Quinta-feira, 20 de Maio de 2010, 13:04
Giancarlo Boaron wrote:

Hi all.

Recently, I wrote an email about the problem I was

having with some Postgres functions that when those
functions were called, I received the following error: "Call
to undefined function <function_name>".

After some answers, I decided to rebuild a brand new

linux virtual machine with Apache + PHP + Postgres, but I
still get this annoying error messege with some functions
like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with

--with-apxs2=/usr/local/apache2/bin/apxs and
--with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something

in php_config.h file? If so, what do I have to change?

Thank you.

Depending on what version of apache you are running, you
need to make sure that
you are loading the pgsql.so file or have the psql.ini file
in your
/var/www/conf/php5/ directory.

This way it knows to load pg.

--
Jim Lucas

"Some men are born to greatness, some
achieve greatness,
and some have greatness
thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

I've generally found these sorts of things to be in /etc/php, /etc/php5
or something similar. Within /etc you should see directories for both
Apache and PHP. If you have shell access to the machine, try calling a
whereis command, which might give you a better idea of where things are
kept in your system.

Thanks,
Ash
http://www.ashleysheridan.co.uk

#9Ketema Harris
ketema@ketema.net
In reply to: Ashley Sheridan (#8)
Re: [PHP] Some undefined function errors

you might want to also check your architecture flags for your compiler.

i ran into this problem on a mac when I was compiling php and by default it tries to make a 32 bit and 64 bit binary, but pg was compiled as 64 bit only. I found that the php compile did not fail, but i was "missing" some functions just like you. when I recompiled php only 64 bit everything was picked up.

I found that watching the configure output gave indication as to whether or not certain functions will be picked up:

PQescapeString
PQunescapeBytea
PQsetnonblocking
PQcmdTuples
PQoidValue
PQclientEncoding
PQparameterStatus
PQprotocolVersion
PQtransactionStatus
PQexecParams
PQprepare
PQexecPrepared
PQresultErrorField
PQsendQueryParams
PQsendPrepare
PQsendQueryPrepared
PQputCopyData
PQputCopyEnd
PQgetCopyData
PQfreemem
PQsetErrorVerbosity
PQftable
PQescapeStringConn
PQescapeByteaConn
pg_encoding_to_char

If you see these thigns set to NO even after PostgreSQL support says yes, then you know you wont be getting all the functions.

Ketema J. Harris
ketema@ketema.net
ketema@jabber.ketema.net (Jabber)
http://www.ketema.net
ketema@voip.ketema.net - VoIP
407-459-4809 - main
603-413-2882 - fax

On May 20, 2010, at 12:26 PM, Ashley Sheridan wrote:

Show quoted text

On Thu, 2010-05-20 at 09:21 -0700, Giancarlo Boaron wrote:

Hi Jim.

I think it depends on each server configuration but I checked in my server and I don't have the 'pgsql.so' and 'psql.ini' files and neither the 'www' directory.

My Apache version is 2.2.15 and my root directory is /usr/local/apache2/htdocs.

Thank you.

--- Em qui, 20/5/10, Jim Lucas <lists@cmsws.com> escreveu:

De: Jim Lucas <lists@cmsws.com>
Assunto: Re: [PHP] Some undefined function errors
Para: "Giancarlo Boaron" <gboaron@yahoo.com.br>
Cc: pgsql-general@postgresql.org, php-general@lists.php.net, pgsql-novice@postgresql.org
Data: Quinta-feira, 20 de Maio de 2010, 13:04
Giancarlo Boaron wrote:

Hi all.

Recently, I wrote an email about the problem I was

having with some Postgres functions that when those
functions were called, I received the following error: "Call
to undefined function <function_name>".

After some answers, I decided to rebuild a brand new

linux virtual machine with Apache + PHP + Postgres, but I
still get this annoying error messege with some functions
like pg_prepare() and pg_escape_string().

I compiled Postgres with --without-readline option.
I compiled PHP with

--with-apxs2=/usr/local/apache2/bin/apxs and
--with-pgsql=/usr/local/pgsql/

And the compilation process has no errors.

What am I doing wrong? Do I have to change something

in php_config.h file? If so, what do I have to change?

Thank you.

Depending on what version of apache you are running, you
need to make sure that
you are loading the pgsql.so file or have the psql.ini file
in your
/var/www/conf/php5/ directory.

This way it knows to load pg.

--
Jim Lucas

"Some men are born to greatness, some
achieve greatness,
and some have greatness
thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

I've generally found these sorts of things to be in /etc/php, /etc/php5 or something similar. Within /etc you should see directories for both Apache and PHP. If you have shell access to the machine, try calling a whereis command, which might give you a better idea of where things are kept in your system.

Thanks,
Ash
http://www.ashleysheridan.co.uk