如何在另一个 php.ini 文件中包含一个 php.ini 文件? [英] How do I include a php.ini file in another php.ini file?

查看:25
本文介绍了如何在另一个 php.ini 文件中包含一个 php.ini 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在另一个 php.ini 文件中包含一个 php.ini 文件?

How do I include a php.ini file in another php.ini file?

推荐答案

我不认为你可以包含"来自主 php.ini 文件的 .ini 文件.

I don't think you can "include" .ini files from the main php.ini file.

不过,一种可能的解决方案可能是在编译 PHP 时在配置行上使用此选项:

One possible solution, though, might be to use this option on the configure line, when compiling PHP:

--with-config-file-scan-dir=PATH
    Set the path where to scan for configuration files

如果在编译时使用该选项,PHP 将查找此目录中的每个 .ini 文件,除了正常"的 .ini 文件.php.ini 文件.

If this option is used at compile-time, PHP will look for every .ini file in this directory, in addition to the "normal" php.ini file.

我想这就是 Ubuntu 使用的,例如,它为每个下载的扩展使用不同的 .ini 文件,而不是修改 php.ini.

I suppose this is what is used by Ubuntu, for instance, which uses a different .ini file for each downloaded extension, instead of modifying php.ini.

php.ini 文件的路径是用这个选项定义的,在配置行:

The path to the php.ini file is being defined with this option, on the configure line:

--with-config-file-path=PATH
    Set the path in which to look for php.ini [PREFIX/lib]

不过,这可能意味着您必须重新编译 PHP —— 这并不难,顺便说一句 —— 最难的部分是获得所需的依赖项.

Still, it probably means you'll have to re-compile PHP -- which is not that hard, btw -- the hardest part being to get the dependencies you need.

而且,这里有一篇关于 internals@ mailling-list 的帖子,和我说的一样:配置文件和PHP_CONFIG_FILE_SCAN_DIR

And, here is a post on the internals@ mailling-list that says the same thing as I do: config files and PHP_CONFIG_FILE_SCAN_DIR

这篇关于如何在另一个 php.ini 文件中包含一个 php.ini 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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