I’ve started today a new project in PHP on my Mac and started with the following error message in my php error log file:
I try to get homebrew running in order to install some unix tools on may mac and have trouble getting started. I already removed fink and macports und installed homebrew. (I'm running Snow Leopard. I am trying to run a unix command line for some i18n work on a project. Using gettext library my issue is about running msgmerge $ msgmerge zsh: command not found: msgmerge I tried brew instal gettext and brew link gettext but with no success. This was working well on my previous machine, but can't make it work on a fresh install.
[19-Jan-2014 10:39:14 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/php_gettext.dll' – dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/php_gettext.dll, 9): image not found in Unknown on line 0
So first you’ll notice it’s looking for a DLL on my Mac so obviously it won’t work. The first thing to check is php.ini:
Ok so it’s really writte .dll in there. I’m not too sure whether I did it some time ago or whether it was installed like this. I’m pretty sure it used to work fine in the past since I was working on another project which didn’t have any problem with gettext. Inbetween I’ve upgraded to Mavericks but it might just be that I was working very late at night and modified php.ini on my Mac instead of doing it in my Windows virtual machine.
So I changed .dll to .so but without better results. Of course, I had checked the referenced extensions path first, I’d have seen that there are no files there except for xdebug.so.
So it looks like I’ll have to install php_gettext first. That’s not sp difficult.
First you need to find out which version of PHP is installed so that you can download the sources for this version:
If you have a different version, you’ll need to change 5.4.17 to that version in all commands below.
Then create a working directory for building gettext for PHP:
Now we need to download the PHP sources and uncompress them:
Brew Link Gettext
Then we’ll install the latest version of gettext using Homebrew:
Macos Brew Gettext
Then we’ll prepare the PHP extension for compiling:
So something is missing. After a long search it seems I needed to install the command line developer tools:
Now it looks better so we can continue, with configuring and building gettext (use the version number installed by brew instead of 0.18.3.2 in the command below):
So the shared library /tmp/gettext/php-5.4.17/ext/gettext/modules/gettext.so was created and we just need to copy it as php_gettext.so with:
And restart apache:
And now the error is gone ! You can now safely remove the directory /tmp/gettext.
Related posts: