macにgettextを入れる

undefined function bindtextdomainと出た。

gettextが必要とのこと。

 

brew install gettextで入れる

 

自分の環境はphp-versionでphpを構築

 

cd /var/tmp/php-build/source/5.4.0/ext/gettext/

 

phpize

./configureでエラー

configure: error: Cannot locate header file libintl.h

 

libintlがないといのだから

libintlをインストールしようと調査。

 

icu4cを入れるといいよという記事がったので入れようとする(たぶん関係なかった)

brew install icu4c

 

ほんで

cd /var/tmp/php-build/source/5.4.0/ext/intl/

phpize

--enable-intl --with-icu-dir=$(brew --prefix icu4c)

make

コンパイル通ったのでsoファイルをコピー

cp modules/intl.so ~/local/php/versions/5.4.0/lib/php/extensions/no-debug-non-zts-20100525/

 

試すがやっぱりエラー。

cd /var/tmp/php-build/source/5.4.0/ext/gettext/

phpize

./configureでエラー

configure: error: Cannot locate header file libintl.h

 

 

パスを指定してみよう

./configure --with-gettext-dir=$(brew --prefix gettext)

通った。

make

おけ。

 

cp modules/gettext.so ~/local/php/versions/5.4.0/lib/php/extensions/no-debug-non-zts-20100525/

 

apache再起動

phpinfo確認

 

gettextあり。bindtextdomain使用できるようになった。

 

だけど、、、bind_textdomain_codesetが相変わらずundefind function

なんだこれ。ちくしょう、解決できないでいまここ。

 

参考サイト

http://okamuuu.hatenablog.com/entry/2013/03/13/154802

http://rimpei.org/blog/2011/01/mac-php-enable-intl