search
Homephp教程php手册php.ini-dist 和 php.ini-recommended 的区别介绍

在下载php后,进行配置的时候,会出现两个php.ini:php.ini-dist和php.ini-recommended,那有什么不同呢?应该如果选择适合自己的版本呢

php.ini-recommended的安全等级比php.ini-dist高。默认是把display_errors 设置为 off,将magic_quotes_gpc 设置为Off等等。而相对的php.ini-dist都是默认的配置。 所以说,如果你只是想进行web测试和普通开发,使用php.ini-dist,不然就是用php.ini-recommended。

具体参阅

简单说明:

如果是本地开发学习,建议复制 php.ini-dist一份保存为php.ini

如果是服务器上使用,为了安全,复制php.ini-recommended一份保存为php.ini

PhpIniDir的应用

PhpIniDir是PHP的初始化文件php.ini的路径,过去大家将php.ini放在windows目录下,在PHP5中,PHP.ini的查找路径不再限于PHP4时代的%SystemRoot%,PHP5会按以下顺序查找PHP.ini:

1、PHPIniDir(Apache 2 module only,这个指令仅仅用于当PHP作为Apache模块时使用,不支持CGI运行的PHP)
2、键值:HKEY_LOCAL_MACHINE/SOFTWARE/PHP/IniFilePath
3、环境变量:%PHPRC%
4、PHP5的目录(for CLI),或者web服务器目录(for SAPI modules)
5、Windows目录(C:/windows or C:/winnt)

这五个方案中,配合Apache2时最好使用PHPIniDir,即在apache2/conf/httpd.conf文件中加入:

# configure the path to php.ini
PHPIniDir " C:/php"

另外,NTFS上记得给服务器开PHP.ini的读权限。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft