有可能拆分PHP配置文件php.ini? [英] Is possible to split PHP configuration file php.ini?

查看:240
本文介绍了有可能拆分PHP配置文件php.ini?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何使用php的人都知道php.ini是一个大文件,当你需要转换ssh时可能会引起麻烦。

Anyone working with php knows that php.ini is a big file that may cause headaches when you need to change over ssh.

例如我可以改变nginx。 conf使用 include 指令将site-enabled dir下的所有文件加载到主nginx.conf中。

For example I can change nginx.conf using include directive to load all of the files under sites-enabled dir into the main nginx.conf.

所以我的问题很简单:可以用php.ini做同样的事情吗?

So my question is straightforward: It's possible to do the same thing with php.ini ?

推荐答案

如果您的PHP安装设置为扫描.ini文件,您可以将其中几个放在一个文件夹中。如果你通过Ubuntu repos安装PHP,它应该已经这样配置了。

If your PHP installation is setup to scan for .ini files you can drop several of them in a folder. If you installed PHP through the Ubuntu repos, it should already be configured this way.

我的 phpinfo()(注意:额外的ini文件是从repos安装php扩展的结果,将不包含在PHP中):

My phpinfo() (note: The additional ini files are the result of installing php extensions from the repos and won't be included with PHP):

此目录的设置是编译时选项:

The setting for this directory is a compile-time option:

--with-config-file-scan-dir=/etc/php5/apache2/conf.d

您还可以通过Apache设置环境变量:

You can also set an environment variable through Apache:

SetEnv PHP_INI_SCAN_DIR /php/custom/scan/directory

更多信息@ ServerFault

这篇关于有可能拆分PHP配置文件php.ini?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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