I'm using PHP 7.2.10 on my laptop that runs on Windows 10 Home Single Language 64-bit operating system.
I've installed the latest version of XAMPP installer on my laptop which has installed the Apache/2.4.34 (Win32)
I come across following text from the PHP Manual :
.user.ini files
Since PHP 5.3.0, PHP includes support for configuration 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 running PHP as Apache module, use
.htaccess
files for the same effect.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']
). In case the PHP file is outside the document root, only its directory is scanned.Only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will be recognized in .user.ini-style INI files.
Two new INI directives, user_ini.filename and user_ini.cache_ttl control the use of user INI files.
user_ini.filename sets the name of the file PHP looks for in each directory; if set to an empty string, PHP doesn't scan at all. The default is .user.ini.
user_ini.cache_ttl controls how often user INI files are re-read. The default is 300 seconds (5 minutes).
Following are the doubts that have created in my mind after reading the above text :
- Does PHP automatically scan the
INI files
(i.e..user.ini-style INI files
(.htaccess files
in case of PHP running as Apache module)) in each directory? I mean isn't there a need to specify the directories of the project that containsINI files
(i.e..user.ini-style INI files
(.htaccess files
in case of PHP running as Apache module))? - Is it mandatory for each directory of the project to have
INI files
(i.e..user.ini-style INI files
(.htaccess files
in case of PHP running as Apache module))? - Do the
INI files
(i.e..user.ini-style INI files
(.htaccess files
in case of PHP running as Apache module)) present in different directories of the project can have same directives with different values or missing some directives or having some additional directives? - How it is possible to set the PHP directives in a
.htaccess
file which is related to the Apache web server? - What does actually mean by the clause 'PHP scans for INI files in each directory'? Does it mean PHP parser reads INI files in each directory?
Please do provide answers to all of my above questions in step-by-step manner.
Thank you.