Thread: Postgres from PHP in Leopard

Postgres from PHP in Leopard

From
Gordon
Date:
I'm a web developer who does a lot of work in PHP.  The back end
database we use is bases on Postgres.  I am trying to set my new
MacBook Pro up as a development system.

I have managed to install Postgres from http://sourceforge.net/projects/pgsqlformac/
and can access the database on my mac with tools such as pgAdmin.  I
have also enabled the bundled Apache and PHP extensions.

However, the problem is that I can't get PHP to talk to Postgres.
Running phpinfo () on the built in PHP shows that database support
extends as MySql, Mysqli and SQLite extensions, and SQLite drivers for
PDO.  What I really need is a Postgres extension for maintaining older
code and a Postgres PDO driver for new code in development.

When setting up a similar dev system on Windows it was relatively
simple to set this all up.  The extensions for PHP were provided
in .dll files that you just had to include in the php.ini file.  This
doesn't seem to be the case with the MacOS bundled PHP.

Is it possible to download .so files (I believe that's what the MacOS
equivalent to .dll files are) for the drivers and include them from
the php.ini file like on the Windows box?  Or is there something else
I'm meant to be doing?

Re: Postgres from PHP in Leopard

From
Richard Huxton
Date:
Gordon wrote:
> I'm a web developer who does a lot of work in PHP.  The back end
> database we use is bases on Postgres.  I am trying to set my new
> MacBook Pro up as a development system.

I do a fair bit of PHP+PG on my Mac too.

> I have managed to install Postgres from http://sourceforge.net/projects/pgsqlformac/
> and can access the database on my mac with tools such as pgAdmin.  I
> have also enabled the bundled Apache and PHP extensions.

Hmm - never come across that sourceforge project. I installed the
development kit from Apple and compile from source. It's not terribly
difficult.

> However, the problem is that I can't get PHP to talk to Postgres.
> Running phpinfo () on the built in PHP shows that database support
> extends as MySql, Mysqli and SQLite extensions, and SQLite drivers for
> PDO.  What I really need is a Postgres extension for maintaining older
> code and a Postgres PDO driver for new code in development.

There's some older info here:
   http://www.entropy.ch/software/macosx/postgresql/
   http://developer.apple.com/internet/opensource/postgres.html

But I think you want this:
   http://www.finkproject.org/

Access to all sorts of stuff, including alternative versions of apache,
php etc. Read the documentation *before* you start though so you
understand what it's doing.

--
   Richard Huxton
   Archonet Ltd

Re: Postgres from PHP in Leopard

From
John DeSoi
Date:
On Dec 19, 2007, at 6:32 AM, Gordon wrote:

> However, the problem is that I can't get PHP to talk to Postgres.
> Running phpinfo () on the built in PHP shows that database support
> extends as MySql, Mysqli and SQLite extensions, and SQLite drivers for
> PDO.  What I really need is a Postgres extension for maintaining older
> code and a Postgres PDO driver for new code in development.


I think Entropy's package is the easiest way to get this going. It
will get you PHP 5 install that works well with Apache and PostgreSQL.

I have not tried it in Leopard, but hopefully that will work without
problems.


http://www.entropy.ch/software/macosx/php/


John DeSoi, Ph.D.




Re: Postgres from PHP in Leopard

From
Gordon
Date:
On Dec 19, 11:32 am, Gordon <gordon.mc...@ntlworld.com> wrote:
> I'm a web developer who does a lot of work in PHP.  The back end
> database we use is bases on Postgres.  I am trying to set my new
> MacBook Pro up as a development system.
>
> I have managed to install Postgres fromhttp://sourceforge.net/projects/pgsqlformac/
> and can access the database on my mac with tools such as pgAdmin.  I
> have also enabled the bundled Apache and PHP extensions.
>
> However, the problem is that I can't get PHP to talk to Postgres.
> Running phpinfo () on the built in PHP shows that database support
> extends as MySql, Mysqli and SQLite extensions, and SQLite drivers for
> PDO.  What I really need is a Postgres extension for maintaining older
> code and a Postgres PDO driver for new code in development.
>
> When setting up a similar dev system on Windows it was relatively
> simple to set this all up.  The extensions for PHP were provided
> in .dll files that you just had to include in the php.ini file.  This
> doesn't seem to be the case with the MacOS bundled PHP.
>
> Is it possible to download .so files (I believe that's what the MacOS
> equivalent to .dll files are) for the drivers and include them from
> the php.ini file like on the Windows box?  Or is there something else
> I'm meant to be doing?

Anyone?

Re: Postgres from PHP in Leopard

From
Steve Atkins
Date:
On Dec 20, 2007, at 7:35 AM, Gordon wrote:

> On Dec 19, 11:32 am, Gordon <gordon.mc...@ntlworld.com> wrote:
>> I'm a web developer who does a lot of work in PHP.  The back end
>> database we use is bases on Postgres.  I am trying to set my new
>> MacBook Pro up as a development system.
>>
>> I have managed to install Postgres fromhttp://sourceforge.net/projects/pgsqlformac/
>> and can access the database on my mac with tools such as pgAdmin.  I
>> have also enabled the bundled Apache and PHP extensions.
>>
>> However, the problem is that I can't get PHP to talk to Postgres.
>> Running phpinfo () on the built in PHP shows that database support
>> extends as MySql, Mysqli and SQLite extensions, and SQLite drivers
>> for
>> PDO.  What I really need is a Postgres extension for maintaining
>> older
>> code and a Postgres PDO driver for new code in development.
>>
>> When setting up a similar dev system on Windows it was relatively
>> simple to set this all up.  The extensions for PHP were provided
>> in .dll files that you just had to include in the php.ini file.  This
>> doesn't seem to be the case with the MacOS bundled PHP.
>>
>> Is it possible to download .so files (I believe that's what the MacOS
>> equivalent to .dll files are) for the drivers and include them from
>> the php.ini file like on the Windows box?  Or is there something else
>> I'm meant to be doing?
>
> Anyone?

It sounds like a PHP problem, not a Postgresql problem. You're
more likely to get help with it if you ask on a PHP mailing list, I
suspect.

Cheers,
   Steve


Re: Postgres from PHP in Leopard

From
brian
Date:

Steve Atkins wrote:
>
> On Dec 20, 2007, at 7:35 AM, Gordon wrote:
>
>> On Dec 19, 11:32 am, Gordon <gordon.mc...@ntlworld.com> wrote:
>>
>>> I'm a web developer who does a lot of work in PHP.  The back end
>>> database we use is bases on Postgres.  I am trying to set my new
>>> MacBook Pro up as a development system.
>>>
>>> I have managed to install Postgres
>>> fromhttp://sourceforge.net/projects/pgsqlformac/
>>> and can access the database on my mac with tools such as pgAdmin.  I
>>> have also enabled the bundled Apache and PHP extensions.
>>>
>>> However, the problem is that I can't get PHP to talk to Postgres.
>>> Running phpinfo () on the built in PHP shows that database support
>>> extends as MySql, Mysqli and SQLite extensions, and SQLite drivers  for
>>> PDO.  What I really need is a Postgres extension for maintaining  older
>>> code and a Postgres PDO driver for new code in development.
>>
>
> It sounds like a PHP problem, not a Postgresql problem. You're
> more likely to get help with it if you ask on a PHP mailing list, I
> suspect.

It's a bit of both, really. You might need to re-compile PHP to make it
aware of PG. Did you install it through Fink?

Which ever, I suggest you have a look at these articles (mind the
line-breaks):

http://fatalerror.wordpress.com/2007/12/23/\
installing-apache-php-mysql-postgresql-on-mac-osx-leopard-from-source/

http://fatalerror.wordpress.com/2007/12/14/\
running-apache-2-php5-entropy-with-postgresql-on-leopard/

brian

Re: Postgres from PHP in Leopard

From
Shane Ambler
Date:
brian wrote:
>
>
> Steve Atkins wrote:
>>
>> On Dec 20, 2007, at 7:35 AM, Gordon wrote:
>>
>>> On Dec 19, 11:32 am, Gordon <gordon.mc...@ntlworld.com> wrote:
>>>
>>>> I'm a web developer who does a lot of work in PHP.  The back end
>>>> database we use is bases on Postgres.  I am trying to set my new
>>>> MacBook Pro up as a development system.
>>>>
>>>> I have managed to install Postgres
>>>> fromhttp://sourceforge.net/projects/pgsqlformac/
>>>> and can access the database on my mac with tools such as pgAdmin.  I
>>>> have also enabled the bundled Apache and PHP extensions.
>>>>
>>>> However, the problem is that I can't get PHP to talk to Postgres.
>>>> Running phpinfo () on the built in PHP shows that database support
>>>> extends as MySql, Mysqli and SQLite extensions, and SQLite drivers  for
>>>> PDO.  What I really need is a Postgres extension for maintaining  older
>>>> code and a Postgres PDO driver for new code in development.
>>>
>>
>> It sounds like a PHP problem, not a Postgresql problem. You're
>> more likely to get help with it if you ask on a PHP mailing list, I
>> suspect.
>
> It's a bit of both, really. You might need to re-compile PHP to make it
> aware of PG. Did you install it through Fink?

That would be Apple - they don't provide postgresql support with the php
supplied with OSX. Also their updates can often wipe out a custom built
version of php.

http://developer.apple.com/internet/opensource/postgres.html

Provides steps to add support which should still apply.


Although he isn't mentioning 10.5 support yet
http://www.entropy.ch/software/macosx/php/
has been a good source of pre-built php for osx which also provides a
larger feature set compiled into php.



--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

Re: Postgres from PHP in Leopard

From
Michael Glaesemann
Date:
On Dec 24, 2007, at 19:28 , Shane Ambler wrote:

> Also their updates can often wipe out a custom built version of php.

If you install your custom-built PHP in /usr/local or use MacPorts
(which uses /opt) or Fink (which uses /sw IIRC), you don't have to
worry about anything being overwritten.

Michael Glaesemann
grzm seespotcode net



[TLM] Re: Postgres from PHP in Leopard

From
Shane Ambler
Date:
brian wrote:
>
>
> Steve Atkins wrote:
>>
>> On Dec 20, 2007, at 7:35 AM, Gordon wrote:
>>
>>> On Dec 19, 11:32 am, Gordon <gordon.mc...@ntlworld.com> wrote:
>>>
>>>> I'm a web developer who does a lot of work in PHP.  The back end
>>>> database we use is bases on Postgres.  I am trying to set my new
>>>> MacBook Pro up as a development system.
>>>>
>>>> I have managed to install Postgres
>>>> fromhttp://sourceforge.net/projects/pgsqlformac/
>>>> and can access the database on my mac with tools such as pgAdmin.  I
>>>> have also enabled the bundled Apache and PHP extensions.
>>>>
>>>> However, the problem is that I can't get PHP to talk to Postgres.
>>>> Running phpinfo () on the built in PHP shows that database support
>>>> extends as MySql, Mysqli and SQLite extensions, and SQLite drivers  for
>>>> PDO.  What I really need is a Postgres extension for maintaining  older
>>>> code and a Postgres PDO driver for new code in development.
>>>
>>
>> It sounds like a PHP problem, not a Postgresql problem. You're
>> more likely to get help with it if you ask on a PHP mailing list, I
>> suspect.
>
> It's a bit of both, really. You might need to re-compile PHP to make it
> aware of PG. Did you install it through Fink?

That would be Apple - they don't provide postgresql support with the php
supplied with OSX. Also their updates can often wipe out a custom built
version of php.

http://developer.apple.com/internet/opensource/postgres.html

Provides steps to add support which should still apply.


Although he isn't mentioning 10.5 support yet
http://www.entropy.ch/software/macosx/php/
has been a good source of pre-built php for osx which also provides a
larger feature set compiled into php.



--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq