Thread: [PHP] RPMs for PHP accessing PostgreSQL via ODBC over RedHat

[PHP] RPMs for PHP accessing PostgreSQL via ODBC over RedHat

From
"Paulo Parola"
Date:
Hi,

We are currently running the following configuration on our server:

Linux Red Hat 7.0
PostgreSQL 7.1beta4-1
PHP 4.0.1pl2

I need to add some RPM package (or perhaps an apache module) to enable PHP
to access PostgreSQL via ODBC.

In order to have PostgreSQL native access support we installed package
'php-pgsql-4.0.1pl2-9.i386.rpm'.

Is there some similar RPM package to enable ODBC access in PHP4.0.1pl2?

If not, how should I procceed?

TIA,
Paulo


Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat

From
"J.Goodleaf"
Date:
Is it really necessary to use PHP and ODBC? PHP has a native postgresql
interface I believe...
 -John

Paulo Parola writes:

> Hi,
>
> We are currently running the following configuration on our server:
>
> Linux Red Hat 7.0
> PostgreSQL 7.1beta4-1
> PHP 4.0.1pl2
>
> I need to add some RPM package (or perhaps an apache module) to enable PHP
> to access PostgreSQL via ODBC.
>
> In order to have PostgreSQL native access support we installed package
> 'php-pgsql-4.0.1pl2-9.i386.rpm'.
>
> Is there some similar RPM package to enable ODBC access in PHP4.0.1pl2?
>
> If not, how should I procceed?
>
> TIA,
> Paulo
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



                               _____________________________
                               |        J. Goodleaf        |
                               |                           |
                           / ) | Technology Coordinator    |
                          / /  | FreeBSD Advocate          |
                         ( (   | email ==>                 |
                       (((\ \> |/ )  john@goodleaf.net     |
                       (\\\\ \_/ /_________________________|
                        \       /
                         \    _/
                         /   /
                        /   /

Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat

From
Chris
Date:
>Is it really necessary to use PHP and ODBC? PHP has a native postgresql
>interface I believe...

It sounds like the postgres server is a different machine to the web
server, so ODBC is needed to communicate between the 2..
I have no answer for that unfortunately :(
This url *might* be of use - http://www.php.net/manual/en/ref.odbc.php

Let us know how you go & what you did :)

>>Hi,
>>We are currently running the following configuration on our server:
>>Linux Red Hat 7.0
>>PostgreSQL 7.1beta4-1
>>PHP 4.0.1pl2
>>I need to add some RPM package (or perhaps an apache module) to enable PHP
>>to access PostgreSQL via ODBC.
>>In order to have PostgreSQL native access support we installed package
>>'php-pgsql-4.0.1pl2-9.i386.rpm'.
>>Is there some similar RPM package to enable ODBC access in PHP4.0.1pl2?
>>If not, how should I procceed?
>>TIA,
>>Paulo

------------------------
Chris Smith
http://www.squiz.net


Re: Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat

From
Michael Fork
Date:
Just FYI, but PHP can be used to talk to a remote postgres server using
native postgres calls, i.e.:

$conn = pg_connect("host=some.host.com user=me password=i db=test");
pg_exec($conn, "SELECT * FROM pg_class");
pg_close($conn);

Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio

On Tue, 6 Mar 2001, Chris wrote:

>
> >Is it really necessary to use PHP and ODBC? PHP has a native postgresql
> >interface I believe...
>
> It sounds like the postgres server is a different machine to the web
> server, so ODBC is needed to communicate between the 2..
> I have no answer for that unfortunately :(
> This url *might* be of use - http://www.php.net/manual/en/ref.odbc.php
>
> Let us know how you go & what you did :)
>
> >>Hi,
> >>We are currently running the following configuration on our server:
> >>Linux Red Hat 7.0
> >>PostgreSQL 7.1beta4-1
> >>PHP 4.0.1pl2
> >>I need to add some RPM package (or perhaps an apache module) to enable PHP
> >>to access PostgreSQL via ODBC.
> >>In order to have PostgreSQL native access support we installed package
> >>'php-pgsql-4.0.1pl2-9.i386.rpm'.
> >>Is there some similar RPM package to enable ODBC access in PHP4.0.1pl2?
> >>If not, how should I procceed?
> >>TIA,
> >>Paulo
>
> ------------------------
> Chris Smith
> http://www.squiz.net
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>


Re: Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat

From
"Brett W. McCoy"
Date:
On Tue, 6 Mar 2001, Chris wrote:

> >Is it really necessary to use PHP and ODBC? PHP has a native postgresql
> >interface I believe...
>
> It sounds like the postgres server is a different machine to the web
> server, so ODBC is needed to communicate between the 2..

No it isn't.  Postgres should be accessible via PHP whether it's on the
same server or on a remote server (and Postgres is configured to allow
remote access).  The only reason I can guess as to why ODBC is being used
is to perhaps maintain code compatibility with the use of a different
databse platform that the web server may have been using previously.

-- Brett

                http://www.chapelperilous.net/~bmccoy/
------------------------------------------------------------------------
I didn't get sophisticated -- I just got tired.  But maybe that's what
sophisticated is -- being tired.
        -- Rita Gain


Re: Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat

From
Chris
Date:
> > >Is it really necessary to use PHP and ODBC? PHP has a native postgresql
> > >interface I believe...
> >
> > It sounds like the postgres server is a different machine to the web
> > server, so ODBC is needed to communicate between the 2..
>
>No it isn't.  Postgres should be accessible via PHP whether it's on the
>same server or on a remote server (and Postgres is configured to allow
>remote access).  The only reason I can guess as to why ODBC is being used
>is to perhaps maintain code compatibility with the use of a different
>databse platform that the web server may have been using previously.
>
>-- Brett

I've never tried so had no idea :)

How do you configure it into PHP?

./configure --help | grep pgsql
   --with-pgsql[=DIR]      Include PostgreSQL support.  DIR is the PostgreSQL
                           base install directory, defaults to
/usr/local/pgsql.

------------------------
Chris Smith
http://www.squiz.net


Re: Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat

From
"Paulo Parola"
Date:
The case is really code compatibility. I have benn using PHP to access mSQL,
MySQL and PostgreSQL natively for quite a while, *but* we need to port an
apllication currently running on NT written in PHP and accessing MS Access
using ODBC. We have already exported the database to PostgreSQL over RedHat
Linux and have even configured phpPgAdmin for administering it through the
Web. The thing is we want to keep our code using PHP ODBC functions to
access the database and not use the native calls.

I know I can build PHP from the source specifying options such
as --with-unixodbc or --with-iodbc, *but* I am currently on an install where
I only used RPMs to configure everything and was wondering how I could do
that without having to build everything from tarballs (./configure, make,
make install...) and keep RedHat RPM package facilities and perhaps enable
PHP to comunicate to PostgreSQL through ODBC just by installing some RPM (I
also won't have the need to have the database and the application at
different servers - they are actually residing at the same machine).

Any hints?

TIA,
Paulo


----- Original Message -----
From: Chris <csmith@squiz.net>
To: <pgsql-general@postgresql.org>
Sent: Monday, March 05, 2001 8:02 PM
Subject: Re: [GENERAL] Re: RPMs for PHP accessing PostgreSQL via ODBC over
RedHat


>
> > > >Is it really necessary to use PHP and ODBC? PHP has a native
postgresql
> > > >interface I believe...
> > >
> > > It sounds like the postgres server is a different machine to the web
> > > server, so ODBC is needed to communicate between the 2..
> >
> >No it isn't.  Postgres should be accessible via PHP whether it's on the
> >same server or on a remote server (and Postgres is configured to allow
> >remote access).  The only reason I can guess as to why ODBC is being used
> >is to perhaps maintain code compatibility with the use of a different
> >databse platform that the web server may have been using previously.
> >
> >-- Brett
>
> I've never tried so had no idea :)
>
> How do you configure it into PHP?
>
> ./configure --help | grep pgsql
>    --with-pgsql[=DIR]      Include PostgreSQL support.  DIR is the
PostgreSQL
>                            base install directory, defaults to
> /usr/local/pgsql.
>
> ------------------------
> Chris Smith
> http://www.squiz.net
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


How robust is postgresql ?

From
"Simon Crute"
Date:
Hi all,
  We're writing an app in Perl and currently using Oracle as the backend
database (via the perl DBI) but due to the costs when we put this live we're
thinking of useing Postgresql.

However we need to know how crash resistant Posgresql is. Oracle has the
"Archive log mode" which writes a log of everything that's casued the
database to change. This allows you to recoved it properly in the event of a
crash.

Does Postgresql have anything simmilar ? I've read about Postgresql's "fsync
mode". Does this guarantee that the data is written to the disk properly and
that the in the even of a crash (such as power outage etc) the database will
still be correct ?

The other question is Backups. Is there anyway to take diferential backups ?
I.E do a full dump periodically, and then make diferential backups from time
to time (preferably to a differet box)

Thanks.




Re: How robust is postgresql ?

From
"Brett W. McCoy"
Date:
On Tue, 6 Mar 2001, Simon Crute wrote:

>   We're writing an app in Perl and currently using Oracle as the backend
> database (via the perl DBI) but due to the costs when we put this live we're
> thinking of useing Postgresql.

Good choice!  Version 7.1, now in beta and due out very soon, has a lot of
new stuff that is very smart and cool.

> However we need to know how crash resistant Posgresql is. Oracle has the
> "Archive log mode" which writes a log of everything that's casued the
> database to change. This allows you to recoved it properly in the event of a
> crash.
>
> Does Postgresql have anything simmilar ? I've read about Postgresql's "fsync
> mode". Does this guarantee that the data is written to the disk properly and
> that the in the even of a crash (such as power outage etc) the database will
> still be correct ?

7.1 has write-ahead logging (WAL), which does what you are looking for.
See http://www.postgresql.org/devel-corner/docs/admin/wal.html

The fsync mode also helps with data integiry, but it *really* slows down
the system, unfortunately.

> The other question is Backups. Is there anyway to take diferential backups ?
> I.E do a full dump periodically, and then make diferential backups from time
> to time (preferably to a differet box)

You can do a database dump and back up the SQL generated, or do a
filesystem backup.  See
http://www.postgresql.org/devel-corner/docs/admin/backup.html for
information on the specifics.

-- Brett
                http://www.chapelperilous.net/~bmccoy/
------------------------------------------------------------------------
You can't mend a wristwatch while falling from an airplane.


Re: How robust is postgresql ?

From
John Madden
Date:
> You can do a database dump and back up the SQL generated, or do a
> filesystem backup.  See
> http://www.postgresql.org/devel-corner/docs/admin/backup.html for
> information on the specifics.

Yum - can filesystem backups be done in 7.0.x?  (I would much prefer to
killall -15 postmaster and copy files around than deal with pg_dump
stuff.)  Or do I have to wait for 7.1?

(If that's the case, I think I'll just not backup any databases until I
can upgrade them ;))

Thanks,
  John






Re: How robust is postgresql ?

From
will trillich
Date:
On Wed, Mar 07, 2001 at 02:18:41PM -0500, John Madden wrote:
> > You can do a database dump and back up the SQL generated, or do a
> > filesystem backup.  See
> > http://www.postgresql.org/devel-corner/docs/admin/backup.html for
> > information on the specifics.
>
> Yum - can filesystem backups be done in 7.0.x?  (I would much prefer to
> killall -15 postmaster and copy files around than deal with pg_dump
> stuff.)  Or do I have to wait for 7.1?
>
> (If that's the case, I think I'll just not backup any databases until I
> can upgrade them ;))

you're brave, like i was, last week. i'm a bit more meek these
days... :)

i rather like the textual 'dump/restore' concept, as it'll
compress nicely, and can be diff'd easily for iterative backups,
as well. plus on recreating (when needed) you'll have the same
data but <guess>probably even cleaner datafiles than you'd have
after a vacuum.</guess> plus it's easy to do remote yanks via
`pg_dump -h server.host.name` without any nfs or other clutter...

--
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
        -- Isaac Asimov, 'The Genetic Code'

will@serensoft.com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Re: How robust is postgresql ?

From
"Simon Crute"
Date:
Thanks for the answer, (and thanks to adb too)
>
> 7.1 has write-ahead logging (WAL), which does what you are looking for.
> See http://www.postgresql.org/devel-corner/docs/admin/wal.html
>
> The fsync mode also helps with data integiry, but it *really* slows down
> the system, unfortunately.

Looks like WAL is what we want. I understand that 7.1 should be out in a few
weeks ?

> > The other question is Backups. Is there anyway to take diferential
backups ?
> > I.E do a full dump periodically, and then make diferential backups from
time
> > to time (preferably to a differet box)
>
> You can do a database dump and back up the SQL generated, or do a
> filesystem backup.  See
> http://www.postgresql.org/devel-corner/docs/admin/backup.html for
> information on the specifics.

I was looking for ways of backing up only data that had changed since the
last backup. The server will probably be hosted with an ISP so I don't want
unnecessary data transfers.