PHP expansion-"config"

Source: Internet
Author: User
Tags php development environment
PHP extension-"config"
The config extension is an implementation that loads configuration options into memory and optimizes the configuration file loading process.


Recommended Use scenarios:

1, multiple projects need to call the common configuration, using Config to manage, avoid multiple copies of copy maintenance.

2, a lot of configuration options, using config loaded into memory, you can avoid PHP every time the configuration file to interpret the execution.


Project Address:Http://git.oschina.net/365690485/php_extension_config



Note: Currently only Test compiled PHP5.3.3, other versions are not tested for compilation


first look at a simple config.ini:

Parameter value length cannot exceed 255[define];============================ service center domain name ======================; message forwarding server node one msg_server_0            =       http://msg0.10000.cn/; User Service center URL user_service            =       http://user.service.10000.cn/; Message Service Center URL Msg_service             =       http://msg.service.10000.cn/[config]max_upload_size          =      2048login_redirect_url          =     http ://login.service.10000.cn/


syntax Format:

“;” Start with comments

[Define] The following option, which represents the definition of a macro, is equivalent to define (key, value), which is called by the client: Echo msg_server_0

[Config], which represents the list defined as Key-value, the client invocation method: Echo config (' max_upload_size ')


Recommended Use scenarios:

1, multiple projects need to call the common configuration, using Config to manage, avoid multiple copies of copy maintenance.

2, a lot of configuration options, using config loaded into memory, you can avoid PHP every time the configuration file to interpret the execution.




First, installation Steps (CentOS)

1. Installing the PHP development environment

Yum-y Install Php-devel


2. Unzip the expansion pack

Tar zxf config.tar.gz


3. Go to directory, compile and install

CD configphpize./configure--with-php-config=/usr/bin/php-configmake && make install


4. Configure PHP.ini

End Line New

Extension = Config.so[config]config.path = Configuration file Absolute path


Extended Download: config.tar.gz
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.