doujin4031 2018-07-19 16:40
浏览 79
已采纳

为了按PHP扫描配置INI文件(例如我的情况下的.htaccess文件)是否必须配置PHP?

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条回答 默认 最新

  • drnrxv9383 2018-07-19 17:50
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染