Thread: pg_query undefined?
Does anyone know why trying to run a simple demo script (the one that came with EZ_SQL from php.justinvincent.com) would be giving me an error saying that pg_query() is an undefined function? It's a standard function built into PHP, isn't it? It's listed in the manual... I know the installation of PHP at our web host does have PostgreSQL support, because when I ran phpinfo() it seemed to say all the right things about it, so this is really confusing me. Lynna -- Resource Centre Database Coordinator Gallery 44 www.gallery44.org
Hi Lynna > because when I ran phpinfo() If you run phpinfo() you can see the PHP version. pg_query() is supported since PHP 4.2.0 If your PHP is older than this use pg_exec() instead. Greetings Conni
Lynna Landstreet wrote: > Does anyone know why trying to run a simple demo script (the one that came > with EZ_SQL from php.justinvincent.com) would be giving me an error saying > that pg_query() is an undefined function? It's a standard function built > into PHP, isn't it? It's listed in the manual... > > I know the installation of PHP at our web host does have PostgreSQL support, > because when I ran phpinfo() it seemed to say all the right things about it, > so this is really confusing me. pg_query was new in PHP 4.2: http://us3.php.net/manual/en/function.pg-query.php "pg_query (PHP 4 >= 4.2.0) Note: This function used to be called pg_exec(). pg_exec() is still available for compatibility reasons but users are encouraged to use the newer name." What version does phpinfo say your host is running? Joe
Also make sure that pgsql is installed in php. By checking the phpinfo() function u can verify your php version (4.2+) and if pgsql has been compiled into php. If you have 4.2 or higher than u might need to compile pgsql into php. -- Ray On Sat, 2003-07-12 at 16:54, Lynna Landstreet wrote: > Does anyone know why trying to run a simple demo script (the one that came > with EZ_SQL from php.justinvincent.com) would be giving me an error saying > that pg_query() is an undefined function? It's a standard function built > into PHP, isn't it? It's listed in the manual... > > I know the installation of PHP at our web host does have PostgreSQL support, > because when I ran phpinfo() it seemed to say all the right things about it, > so this is really confusing me. > > > Lynna
Hi all, best to use for simple statements is PEAR::DB. you can write code abstract. i found this out while convert a DB from mysql to pgsql, now we'll wrap table and field names. then we are always sureto write universal code. the problem was the following: mysql table and field names are sometimes uppercase while converting with my2pg.pl all names changed to lowercase alterante: quote tables and fields, but then quote it in your code to. if you try to run this quoted code on mysql you'll get errors. when we have all wrapped, i hope it will run under several RDBMS. excuse my bad english, it's to long ago i learned it and not often spoken. have fun, Gerd Ray Hunter wrote: > Also make sure that pgsql is installed in php. By checking the phpinfo() > function u can verify your php version (4.2+) and if pgsql has been > compiled into php. > > If you have 4.2 or higher than u might need to compile pgsql into php. > > -- > Ray > > On Sat, 2003-07-12 at 16:54, Lynna Landstreet wrote: > >>Does anyone know why trying to run a simple demo script (the one that came >>with EZ_SQL from php.justinvincent.com) would be giving me an error saying >>that pg_query() is an undefined function? It's a standard function built >>into PHP, isn't it? It's listed in the manual... >> >>I know the installation of PHP at our web host does have PostgreSQL support, >>because when I ran phpinfo() it seemed to say all the right things about it, >>so this is really confusing me. >> >> >>Lynna -- -------------------------------------------------------- # Gerd Terlutter | Mueller+Blanck Software GmbH # # gerd@MplusB.de | Gutenbergring 38 # # gerd.terlutter@web.de | D-22848 Noderstedt # # tel:0171/6992579 | tel:+49 40 500 171-1 # # Buero:040/500171-17 | fax:+49 40 500 171-71 # --------------------------------------------------------
on 7/12/03 7:15 PM, Cornelia Boenigk at poppcorn@cornelia-boenigk.de wrote: > If you run phpinfo() you can see the PHP version. > > pg_query() is supported since PHP 4.2.0 > > If your PHP is older than this use pg_exec() instead. Aha - that would be it! Thank you! I just checked phpinfo and it says it's 4.1.2. I can do a global find and replace to turn all instances of pg_query into pg_exec in the ez_sql script I downloaded, but now I wonder if there will be other functions that have changed between versions as well. Guess the only way to find out is to try. *sigh* Yet another reason to loathe and despise the web host I'm stuck with here. I could ask them to upgrade their PHP installation, but given that they never answered my request to upgrade PostgreSQL a month ago (they're still running 7.2), or my *four* requests (well, the same request sent four times) for a working cgi-bin directory, or about 75% of any other tech support requests I've sent them, I'm not holding out too much hope for this one. Can anyone recommend a *good* web host that supports PHP and PostgreSQL? One that's affordable enough for a small non-profit art gallery? Thanks, Lynna -- Resource Centre Database Coordinator Gallery 44 www.gallery44.org
Installed postgreql 7.3.3 and phpPgAdmin 2.4.2 in different machines. Defined password for postgres superuser. Entry is created in the pg_shadow table for the same user. Keeping the access method in pg_hba.conf file as "trust", I do not have any problem. However when changed the access method to "password" and tried managing the database using the phpPgAdmin tool I get
Error - /var/www/pgadmin.intranet/htdocs/lib.inc.php -- Line: 303
PostgreSQL said:
Your query:
Unable to connect with settings: host=host_name' port='post_num' dbname='template1' user='user_id' password='xxxxx'
Your query:
Unable to connect with settings: host=host_name' port='post_num' dbname='template1' user='user_id' password='xxxxx'
The pg_hpa.conf file has an entry
"host all all ip_address ip_mask password"
Any idea why this is happening.
Regards,
Salah
2.4.2 doesn't support 7.3, go get phppgadmin 3.0. Thats not your problem, but you're not going to get too far until you switch to 3.0. Check your postgresql log for a FATAL message when you try and connect, it should give a little better explanation of what went wrong. Robert Treat On Wed, 2003-07-16 at 04:47, Salah Abdulla wrote: > Installed postgreql 7.3.3 and phpPgAdmin 2.4.2 in different machines. > Defined password for postgres superuser. Entry is created in the > pg_shadow table for the same user. Keeping the access method in > pg_hba.conf file as "trust", I do not have any problem. However when > changed the access method to "password" and tried managing the database > using the phpPgAdmin tool I get > > Error - /var/www/pgadmin.intranet/htdocs/lib.inc.php -- Line: 303 > PostgreSQL said: > Your query: > Unable to connect with settings: host=host_name' port='post_num' > dbname='template1' user='user_id' password='xxxxx' > > The pg_hpa.conf file has an entry > "host all all ip_address ip_mask password" > > Any idea why this is happening. > > Regards, > Salah -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
Don't use phpPgAdmin 2.4.2 with Postgres 7.3.x - you should be using phpPgAdmin 3.0
Chris
----- Original Message -----From: Salah AbdullaSent: Wednesday, July 16, 2003 4:47 PMSubject: [PHP] phpPgAdmin 2.4.2Installed postgreql 7.3.3 and phpPgAdmin 2.4.2 in different machines. Defined password for postgres superuser. Entry is created in the pg_shadow table for the same user. Keeping the access method in pg_hba.conf file as "trust", I do not have any problem. However when changed the access method to "password" and tried managing the database using the phpPgAdmin tool I getError - /var/www/pgadmin.intranet/htdocs/lib.inc.php -- Line: 303PostgreSQL said:
Your query:
Unable to connect with settings: host=host_name' port='post_num' dbname='template1' user='user_id' password='xxxxx'The pg_hpa.conf file has an entry"host all all ip_address ip_mask password"Any idea why this is happening.Regards,Salah