'覆盖'php.ini设置 [英] 'Overwrite' php.ini settings

查看:73
本文介绍了'覆盖'php.ini设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件夹,对于该文件夹中(甚至更好的是,该文件夹或其中的任何文件夹)中的所有php文件,我想对php设置进行一些更改。

I have a folder, and for all php files in that folder (or even better, in that folder or any folders within it) I'd like to make some changes to the php settings. Can I just place a php.ini file in that folder with those settings I'd like to change?

如果这样,为什么不会这样做,是否可以将php.ini文件放到该文件夹​​中? 为我工作?

If so, any reason why this wouldn't be working for me? It's my own server.

谢谢!

编辑:我希望能够使用本地服务器php.ini文件,因为我已经可以处理多个虚拟主机。

edit: I'd like to be able to use a local php.ini file, as I've been able to do with several webhosts. Is this a possibility?

推荐答案

似乎您要使用 每个目录的php.ini文件 ,该版本自PHP 5.3起可用。如果是您自己的服务器,我想您很高兴跟上最新的稳定版本(当前为5.3.2)。返回ini文件,引用该手册页:

It looks like you're wanting to use per-directory php.ini files which are available as of PHP 5.3. If it's your own server, I'd like to think you're happy to keep up with the latest stable releases (currently 5.3.2). Back to ini files, to quote that manual page:


自PHP 5.3.0起,PHP在每个目录中都包含对.htaccess风格的INI文件的支持。基础。这些文件仅由CGI / FastCGI SAPI处理。此功能使PECL htscanner扩展无效。如果您使用的是Apache,请使用.htaccess文件以达到相同的效果。

Since PHP 5.3.0, PHP includes support for .htaccess-style INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.

除了主要的php.ini文件之外,PHP还会从每个目录的目录开始扫描INI文件。请求的PHP文件,并一直处理到当前文档的根目录(在$ _SERVER ['DOCUMENT_ROOT']中设置)。在.user.ini样式的INI文件中,只能识别模式为PHP_INI_PERDIR和PHP_INI_USER的INI设置。

In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). Only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will be recognized in .user.ini-style INI files.

这篇关于'覆盖'php.ini设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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