Home >Backend Development >PHP Tutorial >Introduction to the difference between php.ini-dist and php.ini-recommended

Introduction to the difference between php.ini-dist and php.ini-recommended

黄舟
黄舟Original
2016-12-17 09:28:211148browse

php.ini-recommended has a higher security level than php.ini-dist. The default is to set display_errors to off, magic_quotes_gpc to Off, etc. The corresponding php.ini-dist is the default configuration. So, if you just want to do web testing and general development, use php.ini-dist, otherwise use php.ini-recommended.

Simple explanation:

If you are developing and learning locally, it is recommended to copy php.ini-dist and save it as php.ini

If you are using it on a server, for safety, copy php.ini-recommended and save it as php. Application of ini

PhpIniDir

PhpIniDir is the path of PHP’s initialization file php.ini. In the past, everyone placed php.ini in the windows directory. In PHP5, the search path for PHP.ini is no longer limited to %SystemRoot in the PHP4 era. %, PHP5 will search for PHP.ini in the following order:

1. PHPIniDir (Apache 2 module only, this instruction is only used when PHP is used as an Apache module, and does not support PHP running CGI)
2. Registry key value :HKEY_LOCAL_MACHINE/SOFTWARE/PHP/IniFilePath
3. Environment variable: %PHPRC%
4. PHP5 directory (for CLI), or web server directory (for SAPI modules)
5. Windows directory (C:/windows or C: /winnt)

Among these five solutions, it is best to use PHPIniDir when working with Apache2, that is, add to the apache2/conf/httpd.conf file:

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

In addition, remember to give the server read permission for PHP.ini on NTFS.

The above is the introduction of the difference between php.ini-dist and php.ini-recommended. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


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