me, myself and gettext

This blog post is a report with my struggle to install gettext.

php Error Message Screenshot

All this started when I tried to test Unmark as a replacement for the delicious bookmarking service. My installed PHP Version 5.4 did not meet the technical requirements for Unmark so I had to update my PHP Version.

PHP 5.6. First Try

Since upgrading PHP was already on my task-list I jumped to the opportunity and installed PHP Version 5.6 via homebrew. Don't forget to disable the old PHP in the apache configuration http.conf.

$ brew install php56

For some time, everything was smooth and Unmark worked just fine, until one day I opened up a PHP Newsletter project of mine and was confronted with the following PHP warning:

php Warning Message Screenshot
Warning message by PEAR Flexy Template Engine

The PEAR Flexy engine is used to parse an HTML Newsletter Template. The PHP warning message complains about a too long (HTML) string. Also gettext stripped out some of the CSS code in the Newsletter HTML header. Why only some CSS gets stripped out and not the begin or ending of the (HTML) string is beyond me.

It was recently that I started to use Foundations Ink Framework to create HTML Newsletters. I added all of Ink's CSS in the <header> of the HTML Newsletter-Template but it seems some of it was to much. When I moved the CSS into an external file I could work around the problem and later I would in-line all the styles anyway.

A Try to fix the Problem

To avoid this warning I could switch to another PHP Template engine since Flexy is already outdated. But for various reasons this is currently not possible. So I'm stuck with Flexy for now.

In my older PHP Version the gettext extension was not installed and maybe deactivating might solve my problem. In order to turn off PHP extensions I could use the disable-functions setting in the PHP configuration file:

disable_functions = gettext

I also tried to comment out the extension in the php.ini file:


After sudo apachectl restart my to long (HTML) string worked again. I didn't get a warning nor the CSS was stripped from the string as before.

But this solution was futile, which I learned as soon as I opened up phpMyAdmin. Maybe PMA needed an update — but that did't fix the error either. After some digging in the PMA issues & bugs, I found out that PMA uses its own gettext which causes some kind of other problems.

Back to the Start

First I just unlinked the brew php56 package, which I later removed completely.

$ brew unlink php56

Unlinking the brew package and restarting apache brought back my old PHP version, all the errors and warnings where gone. But I wanted the new PHP version 5.6 so I tried another route.

I stumbled across which provides PHP packages with everything pre-compiled for a development environment. And the nice thing is, my old PHP stays intact since the new PHP installation only uses symlinks like brew does. The installation was easy peasy with just one curl command:

$ curl -s | bash -s 5.6

Now I got a shiny new PHP with version 5.6 with a lots of php extensions ready to work. Still, the combination of deactivating gettext and using a "to long" string, brought the PHP-Warning, the string stripping and PMA Error back.

Guess I will have to life with that gettext problem until I'll stumble on a solution or can avoid using the good ol'Flexy. A look at stackoverflow shows gettext causes people a lot of trouble.

Links & Research