Kim's Adventures into Geekspace

To content | To menu | To search

Tag - Postgres

Entries feed - Comments feed

Saturday, October 18 2014

Postgres.app, PHP and Yosemite

After upgrading to Mac OS X Yosemite, the connection to my Postgres-DB from PHP failed again. Funny that Apple puts Postgres on their OS X Server, but don’t compile PHP (on their normal edition) so you can use it.

The help was like last time:

Using this guide:

http://coolestguidesontheplanet.com/upgrade-to-php-5-4-or-5-5-mac-osx-10-8-mountain-lion/

I found this:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4

but decided to go for php 5.5 (I could probably have gone 5.6 by now, but I was at 5.5 before and I didn’t want to break a thing that just works), so I change it to :

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5

And my site was up running again in less than 5 minutes!

There was a warning that 5.5.17 which I got, had not been tested with Yosemite, but it seems to work for me.

Tuesday, October 22 2013

Postgres.app, PHP and Mavericks

Update 10 November 2013: after updating Mavericks from GM to build 13A603, everything broke again. After recompiling like specified below nothing was working and there may have been a missing path somewhere in the php.ini-file. While tracking the error down, I stumbled over a new version of PHP with a one-line install on http://www.coolestguidesontheplanet.com. I decided on 5.5 while I was at it.:

easy PHP 5.5-installation

Just running the installation command, a curl, the postgres-connection was working again, even from a non-standard postgres-installation. Thumbs up.

--

I updated a few of my computers to Mac OS X 10.9 Mavericks. Everything went fine, or so I thought until my wife complained about a missing blog. I happen to run this blog on Dotclear using a Postgres.app-database. Dotclear is of course using php and Apache.

Soon it was clear that the good folks at Apple have dropped support for Postgres in their php-configuration, so what to do. But I found this rather helpful page:

http://blog.rupey.org/post/63221360055/adding-postgres-support-to-php-on-os-x-mavericks

It was not perfect though, as a few steps were a bit shorthanded: installing autoconf from brew for instance, but that was fairly easy after a bit of googling, so I won’t repeat those steps here. See here, if you like.

I think that Rupey gets it very right for the rest, that is if you have Postgres installed by hand, i.e. that it is comfortably sitting in /usr/local/pgsql/ or similar. Given that I had used the app-version - much simpler to install and run - I had to point the configuration to the right directory. So when doing this

cd ext/pdo_pgsql

phpize

./configure

I ended up with this error:

checking for pg_config... not found

configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

To point out the right installation path I just had to do this:

./configure --with-pdo-pgsql=/Applications/Postgres.app/Contents/MacOS/bin

before doing the rest:

make

sudo make install

and finally adding extension=pdo_pgsql.so to /etc/php.ini (and changing the time zone) and doing a sudo httpd -k graceful to make php work with Postgres again. Sorry for the downtime, btw.