什么时候加载/etc/php.d/中的ini文件? [英] When do ini files in /etc/php.d/ get loaded?

查看:281
本文介绍了什么时候加载/etc/php.d/中的ini文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照Apache的加载顺序,何时按PHP .ini文件的顺序加载/etc/php.d/中的文件?我知道对于httpd本身,当调用httpd.conf文件中的Apache include ...指令时,会加载位于/etc/httpd/conf.d/中的.conf文件.加载整个/etc/php.ini文件之后,是否会加载位于/etc/php.d/中的.ini文件?或者/etc/php.ini中是否包含某个文件,可以在某个时刻加载该文件?

In the load order of Apache, when in the order of PHP .ini files are the files that are are in /etc/php.d/ loaded? I know for httpd itself, .conf files located in /etc/httpd/conf.d/ are loaded when the Apache include ... directive in the httpd.conf file is called. Are .ini files located in /etc/php.d/ loaded after the entire /etc/php.ini file is loaded, or is there an include in /etc/php.ini that loads the file at a certain point?

推荐答案

这与Apache无关. PHP ini文件的加载取决于您的PHP二进制文件的编译方式.您可以将选项-with-config-file-scan-dir 配置为在编译时指向目录.

This is nothing to do with Apache. The loading of PHP ini files depends on how your PHP binary is compiled. You can configure the option --with-config-file-scan-dir to point to a directory at compile time.

--with-config-file-scan-dir=/etc/php.d

不需要不需要向您的php.ini添加任何内容.加载初始配置文件后,该目录中的所有.ini文件将按字母顺序 加载.也可以通过设置环境变量来覆盖此配置开关.

You do not need to add anything to your php.ini. All .ini files in this directory will be loaded in alphabetical order after the initial configuration file has been loaded. This configure switch can also be overridden by setting an environment variable.

注意:为防止使用PHP CLI时出现此行为,您可以使用 php二进制文件上的-n开关来关闭ini文件的动态加载.

Note: To prevent this behaviour when using PHP CLI, you can use the switch -n on the php binary to turn off dynamic loading of ini files.

这篇关于什么时候加载/etc/php.d/中的ini文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆