如何在mac上安装gettext?
我在我的一个php页面上收到此错误:
Fatal error: Call to undefined function bindtextdomain()
Run Code Online (Sandbox Code Playgroud)
这是因为我没有安装gettext.
我找不到有关如何安装它的良好说明.我尝试过使用:
brew install gettext
Run Code Online (Sandbox Code Playgroud)
它把一些文件放在这里:
/usr/local/Cellar/gettext/0.18.2
但我不知道该怎么做.
更新:现在我没有尝试使用自制软件,而是尝试使用自制软件:
用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
Run Code Online (Sandbox Code Playgroud)
make check是可选的,用于运行自检
make check
Run Code Online (Sandbox Code Playgroud)
我得到的错误:
make [3]:***[check-TESTS]错误1
make [2]:***[check-am]错误2
make [1]:***[check-recursive]错误1
sudo make install
Run Code Online (Sandbox Code Playgroud)
它安装在这里:/ usr/local/share/gettext
这里的文档:/ usr/local/share/doc/gettext
但是如何让我的php页面能够使用gettext和bindtextdomain()函数?
Gab*_*lla 81
您可以brew在安装后使用链接gettext
brew install gettext
brew link --force gettext
Run Code Online (Sandbox Code Playgroud)
我终于明白了.你必须重新配置php,所以我最终从5.3.15升级到5.4.12.这些网站非常有用:
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
40717 次 |
| 最近记录: |