All this started, when I tried to install and test Unmark, as a replacement for the delicious bookmarking service. My installed PHP Version 5.4 (osX) didn't meet the technical requirements for Unmark so I needed to update.

PHP 5.6. First Try

Since upgrading PHP was already on my Task-List I went forward and installed PHP 5.6 via homebrew.

brew install php56

Everything went smooth and I tested Unmark — until I opened up a Newsletter project of mine and was confronted with this warning.

Warning message produced by the PEAR Flexy Template Engine.

Flexy is used to compile a HTML Newsletter Template and spit out the result. The error boils down to the reason, that I feed a to long (HTML) string to Flexy. So gettext sends a warning and msgid strips out some of my CSS.

Why only some CSS gets stripped and not the begin or the end of the string is beyond me.

I recently started to use Foundations Ink Framework for HTML Newsletters. I added all of Ink's CSS in the <header> of an HTML Newsletter-Template and this was to much. When I move the CSS into an external file I can work around the problem. I would later in-line all the styles anyway.

Try to fix it

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

In my old PHP Version the gettext extension wasn't installed, maybe deactivating it might solve my problem? To deactivate a native PHP function I could use the disable-functions setting in the php.ini file.

disable_functions = gettext

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

;extension=gettext.so

After sudo apachectl restartt my to long (HTML) string worked again with Flexy. I didn't got a warning nor the CSS was stripped from the string before.

But this solution was to no avail, which I learned as soon, as I opened up phpMyAdmin. Maybe PMA needs an update — that did not fix the error either. After some digging in the PMA issues & bugs, I found out that PMA uses its own gettext and that causes some kind of other problems.

Back to the Start

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

brew unlink php56

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

I stumbled across http://php-osx.liip.ch/ which provides PHP packages with everything you need for a development environment. And the nice thing is, my old PHP stays intact since the new PHP installation only uses symlinks like brew. The installation was easy peasy with just one curl command.

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

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

Conclusion

Guess I have to life with that gettext problem until I stumble over a solution or can avoid good ol'Flexy. When I look at stackoverflow.com seems like gettext makes people lots of trouble.

Links & Research