Is it mandatory to configure PHP in order to scan configuration INI files on a per-directory basis(i.e. .htaccess files in my case) by PHP?

血红的双手。 提交于 2019-12-30 07:49:31

问题


I'm using Windows 10 Home Single Language 64-bit Operating System on my machine.

I've installed the latest copy of XAMPP server on my machine which ships with PHP 7.2.7

I read following pages from the PHP Manual :

  1. Scan directories
  2. .user.ini files

After reading the text from these two pages one doubt came to my mind :

To scan the configuration INI files on a per-directory basis(in my case '.htaccess files') by PHP is it mandatory to run PHP on CLI with the --with-config-file-scan-dir option and then by overriding at run time by setting the PHP_INI_SCAN_DIR environment variable?

Or do such configuration INI files on a per-directory basis(in my case '.htaccess files') get scan by PHP automatically?

If yes, then please explain me how the setting made in one environment(i.e. CLI) has effect in an entirely different environment(i.e. SAPI)?

If no, then please clear my confusion with some suitable example.


回答1:


The PHP_INI_SCAN_DIR environment variable is not related to per-directory settings, it does something entirely different. Most Linux distributions build software packages in such a way that settings are kept in different files, so it's easier to install and uninstall individual packages. So this variable is just a trick to split the main configuration file into an undetermined number of separate files inside a directory:

/etc/php.d/

how the setting made in one environment(i.e. CLI) has effect in an entirely different environment(i.e. SAPI)?

It doesn't. The Apache module will not read the FastCGI settings just like Apache will not read IIS settings.



来源:https://stackoverflow.com/questions/51427938/is-it-mandatory-to-configure-php-in-order-to-scan-configuration-ini-files-on-a-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!