Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I recently bought a new MacBook and I'm trying to configure it for PHP development.

The operating system is OSX 10.8 Mountain Lion, and I'm using the builtin Apache2 and PHP 5.3.13 stack.

I needed to install some extensions: mcrypt and intl. Both were re-compiled by me (from the source, either from PECL or from the tarball of PHP 5.3.13, using "phpize" then "./configure" and so on) and were installed and activated perfectly.

I'm having issues with the gettext extension. I'm trying to use the one included in PHP 5.3.13 tarball, and I can compile it and install it. The extension is loaded successfully by the interpreter but... It does not work! In fact, when I call for example the bindtextdomain function, I get a PHP error saying it doesn't exist.

Additionally, "make test" return some errors.

The dependency (the gettext library) was installed using MacPorts (version: 0.18.1.1, Revision 2).

Any hint? Thank you.

share|improve this question

closed as off-topic by Michael Hampton Nov 6 at 15:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – Michael Hampton
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

I'd been stumbling on this for the last day too. Having installed gettext from MacPorts (port install gettext) and trying to configure php-gettext from the correct version php source, it would create the extension, but only the gettext() and bindtextdomain() functions were available in php.

A closer look at the output from configure shows lines such as checking for ngettext in -lintl... no

A colleague pointed out that Mac has it's own stripped down version of gettext, so figured that the configure was using that libintl for checking library over the MacPorts version.

Some info posted on a forum in answer to someone having a similar problem for different software on FreeBSD showed me some flags to force it to look in the MacPorts directories first. I used the configure line below, and now all the gettext functions are available in PHP:

./configure --with-gettext=/opt/local CFLAGS=-I/opt/local/include CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib
share|improve this answer
    
Thank you for your answer. First of all, I edited it to add CFLAGS along with CPPFLAGS (because some files are C). This is not fully working, though: now it fails only 1 test (compared to many more it was failing before), but it's the "Gettext basic test" one. And it's still not working in the web server... –  Qualcuno Aug 10 '12 at 13:53
    
I think the problem is that it's still linking against ICU in /usr/local instead of /opt/local... This despite the various flags! (Had a similar issue in the past with other programs) –  Qualcuno Aug 10 '12 at 13:55
    
Here's the full output: pastie.org/4449887 –  Qualcuno Aug 10 '12 at 14:12
    
Actually, I'm wrong. 'otool' shows that the extension is correctly linked against libraries in /opt/local: pastie.org/4449898 ... So, why is it not working?? –  Qualcuno Aug 10 '12 at 14:15
    
Bizarre, worked for me with just the flags that I entered. Did you make clean and phpize --clean before starting again? I forgot and so make and make install didn't update the extension, but it worked fine on two identical Macbook Pros with ML once we started clean. –  CandM Aug 10 '12 at 15:38

An alternative can be using Zend Server for Mac.

share|improve this answer
    
That means having more apps and more complications... I'd rather stick with the official Apache2: it's just a testing environment, eventually. –  Qualcuno Oct 25 '12 at 22:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.