Koozali.org: home of the SME Server

Need help getting PHP to see Postgresql

darkgumby

Need help getting PHP to see Postgresql
« on: August 29, 2004, 04:22:13 AM »
I am running 6.01-01.
I have upgraded to PHP 4.3.8
I have installed Postgresql. The service is running and I was able to create a test database and connect to it.
I have installed php-pgsq
I have updated /etc/php.ini to add the pgsql.so extension.

phpinfo shows --with-pgsql=shared', but there is no other info about pgsql on the phpinfo page.

phppgadmin shows this:
Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option.

What am I missing?

cydonia

Need help getting PHP to see Postgresql
« Reply #1 on: December 15, 2004, 09:43:12 AM »
I'm having the same problem.

Since PHP is installed by default with SME, i assume you would have to update it from source using  --with-pgsql  when you configure?

Its so much harder to use Postgres than Mysql, the rpm for phpMyAdmin works perfectly.  We need something like this for Postgres.

dave_d

Need help getting PHP to see Postgresql
« Reply #2 on: December 15, 2004, 09:57:47 AM »
As with all these things it's easy when you know how, and fiendishly difficult when you don't!

To get PHP to see Postgres ....

Create the file /etc/e-smith/templates-custom/etc/php.ini/70PgsqlExtension.

The file contains one line:

extension=pgsql.so

when you've done that expand the template ...

# /sbin/e-smith/expand-template /etc/php.ini

Then restart Apache

# service httpd restart

.... and now PHP can 'see' Postgres.

As for the Postgres version of MySqlAdmin, do a Google for phpPgAdmin - you'll be surprised at the result.

As for getting it working.... I think I'll let you figure that out and post the results!

Regards,

Dave

cydonia

Need help getting PHP to see Postgresql
« Reply #3 on: December 15, 2004, 10:34:34 AM »
Hi Dave,

Is there any way to verify that this has worked?

I have downloaded phpPgAdmin untarred it, and moved it  to one of my ibays /html folders, but whenever i try to login, i still get:

Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option.


I checked the actual php.ini file in /etc and it did contain the line written in the custom template fragment.  So i'm not sure what else to do.

THanks.
Tristan

dave_d

Need help getting PHP to see Postgresql
« Reply #4 on: December 15, 2004, 03:25:56 PM »
Mmmmmmmm......  good puzzle!

You might start by creating a little .php file containing a call to phpinfo() and 'run' it by visiting it via a web browser.  That will give you loads of information to start with.  The PHP site contains information on how to do this.

Unfortunately I'm tied up with a few Windoze problems right now and it's unlikely that I'll get back to this problem for a while.

Windoze - the greatest money making system for freelancers EVER devised - much better than an operating system!!!

cydonia

Need help getting PHP to see Postgresql
« Reply #5 on: December 15, 2004, 04:57:05 PM »
No probs. Thanks Dave.

I had a feeling this would be an interesting thing to sort out when first began to delve into it all...:P

phpinfo doesn't show up anything too useful at this point.

I will post back if i have a flash of insight in my dreams with regards to solving this problem...thats about the best hope i have:D.

Cheers.
Tristan

dave_d

Need help getting PHP to see Postgresql
« Reply #6 on: December 15, 2004, 06:46:14 PM »
Well ..... being curious about this, I decided to spend 10 minutes on the problem on getting back from the Windoze wrestling match.

I 'ran' phpinfo and checked that pgsql was visible.  You should see

'--with-pgsql=shared'

amongst the configure command output at the top of the page.  You should also find a whole 'pgsql' section later on in the output.  If either of these is missing you'll need to figure out why.  Check back to the source of your PHP installation to make sure that '--with-pgsql' was specified.  Make sure too that you've actually restarted the httpd service!

(# service httpd restart)

Anyway, in my case both were present.

I then made an ibay for phpPgAdmin, set all the usual bits to allow execution of dynamic content, downloaded the phpPgAdmin tarball, expanded it into the ../html part of the ibay, edited ..../conf/config.inc.php to allow logging onto the database with the username 'postgres' (just one edit, changing true to false!!), and then visited the ibay with a web browser.  It all worked first time for me!!

I think you need to check your PHP installation!!

Anyway, on this occasion I got lucky and so I'm off for a :pint: and a curry!

Regards,

Dave

cydonia

Need help getting PHP to see Postgresql
« Reply #7 on: December 16, 2004, 01:46:05 AM »
Thanks again Dave.

My PHPinfo page does show "--with-pgsql=shared".

But i am missing the entire section for pgsql.

Ahhh... Looking at the script i used to update PHP (to version 4.3.9-3), there is a part in the comments where it says:

# 2004-09-29 Laurent Dinclaux relased php-4.3.9
# I have released PHP 4.3.9 RPMs. In addition of Dan Brown releases:
# - Curl extension
# - Compiled with options
#     --enable-sockets --enable-pcntl --enable-sigchild


So its basic now.  I need to edit the rpm to add the another option:  --with-pgsql .

Off i go insearch of how to edit rpms:).

Will report back soon, perhaps even with a modified rpm for this problem.


EDIT: the official PHP upgrade thread i am referring to:
http://forums.contribs.org/index.php?topic=24305.0



Thanks again.
Tristan

dave_d

Need help getting PHP to see Postgresql
« Reply #8 on: December 16, 2004, 08:59:26 AM »
Ah-Ha!  IIRC I had problems with that 4.3.9 upgrade.  I don't recall exactly but somehow it never worked for me!  Go for the 4.3.8 upgrade instead.  Look at

http://forums.contribs.org/index.php?topic=24285.0

Don't forget the pgsql module!

Regards,

Dave
 :-D

cydonia

Need help getting PHP to see Postgresql
« Reply #9 on: December 16, 2004, 10:51:46 AM »
Thanks Dave,

I've tried my best but must be cursed or something...:P

It simly doens't want to work for me.  Somewhere on my server something is broken beyond my understanding.


I updated using a 4.3.8 script, uncommenting the line to download the pgsql module, it updated without a problem.

When i run sysinfo it shows the line:

--with-pgsql=shared


But thats it, there is no actual section for it like with mysql.

I have checked the the paths are correct, i have checked that pgsql.so actually exists, i have checked everything.

I am getting another old PII to test soon so I might try all this on a fresh install and see if it works.


Thanks again for all your help and patience with this problem.  Hopefully the various solutions above work for others, for me its just not gonna work for now.

I'll keep thinking about it and trying things if i think of anything.


Regards,
Tristan

dave_d

Need help getting PHP to see Postgresql
« Reply #10 on: December 16, 2004, 03:15:05 PM »
Just a thought .....  You did check that the modification file in templates-custom still exists, you did check the ACTUAL /etc/php.ini to see that all the Postgres stuff is there, and you DID restart httpd, didn't you?

If you did all that I really don't know what to suggest!!

Regards,

Dave

cydonia

Need help getting PHP to see Postgresql
« Reply #11 on: December 16, 2004, 03:46:27 PM »
Quote from: "dave_d"
Just a thought .....  You did check that the modification file in templates-custom still exists, you did check the ACTUAL /etc/php.ini to see that all the Postgres stuff is there, and you DID restart httpd, didn't you?

If you did all that I really don't know what to suggest!!

Regards,

Dave


Unfortunatly i have checked all those things, by now i've checked them about 5 times each:P.

At this point, i'm putting it down to some wierd error with my server.

I will try reinstall postgres and see if that fixes anything.


Thanks
Tristan

cydonia

Need help getting PHP to see Postgresql
« Reply #12 on: December 16, 2004, 04:19:16 PM »
Dave,

what version of sme/php/postgres are you running?

I am running


SME: 6.0.1-01
PHP: php-4.3.8-1db
PostgreSQL: postgresql-7.4.2-1PGDG


Perhaps its something to do with the versions i'm running.
And if we are running the same, then i know its a problem with my server in particular.


Thanks.
Tristan

dave_d

Need help getting PHP to see Postgresql
« Reply #13 on: December 17, 2004, 08:51:38 AM »
I guess you're getting a bit peeved about all this by now!  from everything you've said it looks as though things ought to work.

However, from my system ....

[root@gandalf etc]# rpm -qa | grep php
php-4.3.8-1db
php-mysql-4.3.8-1db
php-devel-4.3.8-1db
php-ldap-4.3.8-1db
php-odbc-4.3.8-1db
php-snmp-4.3.8-1db
e-smith-php-1.10.0-01
php-imap-4.3.8-1db
php-pgsql-4.3.8-1db
[root@gandalf etc]# rpm -qa | grep postgres
postgresql-7.4.2-1PGDG
postgresql-server-7.4.2-1PGDG
postgresql-docs-7.4.2-1PGDG
postgresql-libs-7.4.2-1PGDG
postgresql-contrib-7.4.2-1PGDG
postgresql-python-7.4.2-1PGDG
postgresql-pl-7.4.2-1PGDG
postgresql-jdbc-7.4.2-1PGDG
postgresql-devel-7.4.2-1PGDG
postgresql-test-7.4.2-1PGDG
[root@gandalf etc]#

.... and I used a version of SME that I downloaded about 3 months ago and it's called 6.0.1-01

I hope this helps.

Regards,

Dave

cydonia

Need help getting PHP to see Postgresql
« Reply #14 on: December 17, 2004, 01:56:51 PM »
Thanks again for all your help Dave.

At this point I must say that its a bug or fault with my machine.  Hopefully i'll get my hands on another machine soon and only install the base software plus postgres.

Its not even like i'm going to use this everyday, but its the first time i've had something on SME that just wouldn't work for me, so i thought it must be solvable.

Anyway, it must be something seriously wrong with PHP  or Postgresql.  Maybe my pgsql.so file is stuffed...

All i know is that its really annoying me:), on principle alone, now i cant rest until i work it out or get it going whatever the hassle...


Thanks.
Tristan