2013-02-18 57 views
11

Macにgettextをインストールするにはどうすればよいですか?Mac OS Xでgettextをインストールする方法

私はPHPのページのいずれかでこのエラーを取得する:

Fatal error: Call to undefined function bindtextdomain() 

と私がインストールさのgettextれていないためです。

インストール方法の説明がわかりません。私が使って試してみた:

brew install gettext 

をし、それがここにいくつかのファイルを置きます:

/usr/local/Cellar/gettext/0.18.2

が、私はと何をするか分かりませんそれ。

更新:代わりに自作を使用しようとしているのは、今私はunsucessfully wgetコマンドを使用して、この方法を試してみました:wgetのと

ダウンロード

cd ~/Downloads 
wget http://ftp.gnu.org/gnu/gettext/gettext-0.18.2.tar.gz 
tar -zxvf gettext-0.18.2.tar.gz 
cd gettext-0.18.2 
./configure 
make 

メイクのチェックがセルフテスト

を実行するオプションです。
make check 

エラー:

メイク[3]:***エラー[-TESTSチェック] 1

メイク[2]:*** [チェック-AM]エラー2

メイク[1]:*** [check-ここでそれをインストールする再帰]エラー1

sudo make install 

: は/ usr/local/share/gettextの

そして、ここでのドキュメント: は/ usr/local/share/docの/ gettextの

しかし、私は私のPHPページは、gettextとbindtextdomain()関数を使用できるようにするのですか?

答えて

8

私はついにそれを手に入れました。 PHPを再構成する必要があるので、5.3.15から5.4.12にアップグレードしました。これらのウェブサイトは非常に有用だった:

http://mac.tutsplus.com/tutorials/server/upgrading-the-native-php-installation-on-os-x-mountain-lion/

http://mansion.im/2011/php-with-intl-and-gettext-on-osx-lion/

#Install dependencies 
brew install libjpeg 
brew install pcre 
brew install libxml2 
brew install mcrypt 

#Get autoconf just because 
brew install autoconf 

#Install Intl extension 
#Install ICU 
#Download from http://site.icu-project.org/download/48#ICU4C-Download 
cd ~/Downloads 
tar xzvf icu4c-4_8_1-src.tgz 
cd icu/source 
./runConfigureICU MacOSX 
make 
sudo make install 

cd ~/Downloads/php-5.4.12/ext/intl 
phpize 
./configure --enable-intl 
make 
sudo cp modules/intl.so /usr/lib/php/extensions/no-debug-non-zts-20090626/ 

#Install gettext 
#Download from http://ftp.gnu.org/gnu/gettext/ 
cd ~/Downloads 
tar xzvf gettext-0.18.1.1.tar.gz 
cd gettext-0.18.1.1 
./configure 
make 
sudo make install 

cd ~/Downloads/php-5.4.12/ext/gettext 
phpize 
./configure  
make 
sudo cp modules/gettext.so /usr/lib/php/extensions/no-debug-non-zts-20090626/ 

#Add intl and get text to php.ini 
cd ~/Downloads/php-5.4.12 
nano php.ini-development 
#Add these lines 
extension=intl.so 
extension=gettext.so 

#Download PHP source files from php.net 
cd ~/Downloads 
tar xzvf php-5.4.12.tar.bz2 
cd php-5.4.12 

./configure \ 
--prefix=/usr \ 
--with-gettext \ 
--mandir=/usr/share/man \ 
--infodir=/usr/share/info \ 
--sysconfdir=/private/etc \ 
--with-apxs2=/usr/sbin/apxs \ 
--enable-cli \ 
--with-config-file-path=/etc \ 
--with-libxml-dir=/usr \ 
--with-openssl=/usr \ 
--with-kerberos=/usr \ 
--with-zlib=/usr \ 
--enable-bcmath \ 
--with-bz2=/usr \ 
--enable-calendar \ 
--with-curl=/usr \ 
--enable-dba \ 
--enable-exif \ 
--enable-ftp \ 
--with-gd \ 
--enable-gd-native-ttf \ 
--with-icu-dir=/usr \ 
--with-iodbc=/usr \ 
--with-ldap=/usr \ 
--with-ldap-sasl=/usr \ 
--with-libedit=/usr \ 
--enable-mbstring \ 
--enable-mbregex \ 
--with-mysql=mysqlnd \ 
--with-mysqli=mysqlnd \ 
--without-pear \ 
--with-pdo-mysql=mysqlnd \ 
--with-mysql-sock=/var/mysql/mysql.sock \ 
--with-readline=/usr \ 
--enable-shmop \ 
--with-snmp=/usr \ 
--enable-soap \ 
--enable-sockets \ 
--enable-sysvmsg \ 
--enable-sysvsem \ 
--enable-sysvshm \ 
--with-tidy \ 
--enable-wddx \ 
--with-xmlrpc \ 
--with-iconv-dir=/usr \ 
--with-xsl=/usr \ 
--enable-zip \ 
--with-imap=/usr/local/imap-2007 \ 
--with-kerberos \ 
--with-imap-ssl \ 
--enable-intl \ 
--with-pcre-regex \ 
--with-pgsql=/usr \ 
--with-pdo-pgsql=/usr \ 
--with-freetype-dir=/usr/X11 \ 
--with-jpeg-dir=/usr \ 
--with-png-dir=/usr/X11 

make test 
sudo make install 

#Restart Apache 
sudo apachectl restart 
+1

感謝をインストールした後、gettextをリンクするbrewを使用することができます。これは私が "-bash:envsubst:command not found"を修正するのを助けてくれた。私はMac(OS X 10.8.5)を手に入れた。 –

44

あなたはそれが

brew install gettext 
brew link --force gettext 
+4

私はこれをうまくやったが、mac os – Rito

+0

から配信されたphpにリンクしているようだ。 OSX El Capitanについて – brujoand

+0

ありがとう –

関連する問題