php 安装并使用配置管理扩展yaconf

Yaconf是一个高性能的PHP配置容器, 它在PHP启动的时候把格式为INI的配置文件Parse后存储在PHP的常驻内存中,不需要每次请求的时候都来分析配置文件。

通常一个项目大了,太多配置文件。这时候就需要一个配置管理容器。

1.安装yaconf

$ git clone  https://github.com/laruence/yaconf
$ cd yaconf
$ /path/to/php7/bin/phpize
$ ./configure --with-php-config=/path/to/php7/bin/php-config
$ make -j
$ make install

2.配置

vim /path/to/php7/bin/php.ini

添加yaconf并配置:

重启:php php-fpm restart

3.使用

vim  /www/web/videos/ini/redis.ini

在你的项目中使用:

原文地址:https://www.cnblogs.com/jackzhuo/p/13878891.html