PHP7添加Intl扩展

由于yii2以来php intl扩展来处理时区问题,所以要对服务器和本地开发环境安装intl扩展。

 

==== CentOS =====

比较简单,直接通过

yum -y install php72w-intl

缺点是,yum会自动更新PHP版本到最新版本,汗。。。好吧,貌似也没出什么问题啦。

 

==== MacOS =====

稍微复杂一点,从PHP7开始,intl作为核心扩展,需要获取PHP源码自行编译。

1. Intl是ICU的封装包,所以需要先安装icu

brew install icu4c

2. 下载PHP源码

3. 编译Intl

cd php-7.2.6/ext/intl

./configure –enable-intl –with-icu-dir=/usr/local/opt/icu4c/ –with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config

make

4. 编译完成后,intl.so在module目录下

88 thoughts on “PHP7添加Intl扩展

Leave a Reply

Your email address will not be published. Required fields are marked *