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

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

问题描述

我有一个文件夹,对于该文件夹中的所有 php 文件(或者甚至更好,在该文件夹或其中的任何文件夹中),我想对 php 设置进行一些更改.我可以在该文件夹中放置一个 php.ini 文件,其中包含我想要更改的设置吗?

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?

如果是这样,有什么理由不会为我工作?这是我自己的服务器.

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']).只有具有 PHP_INI_PERDIR 和 PHP_INI_USER 模式的 INI 设置才能在 .user.ini 样式的 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天全站免登陆