How to set and use PHP_INI_SCAN_DIR environment va

2020-07-24 04:17发布

I've installed PHP 7.2.3 on my machine running on Windows 10. I've installed PHP and Apache httpd 4.29 using latest copy of XAMPP package.

I come across following text from the PHP Manual

It is possible to configure PHP to scan for .ini files in a directory after reading php.ini. This can be done at compile time by setting the --with-config-file-scan-dir option. In PHP 5.2.0 and later, the scan directory can then be overridden at run time by setting the PHP_INI_SCAN_DIR environment variable.

It is possible to scan multiple directories by separating them with the platform-specific path separator (; on Windows, NetWare and RISC OS; : on all other platforms; the value PHP is using is available as the PATH_SEPARATOR constant). If a blank directory is given in PHP_INI_SCAN_DIR, PHP will also scan the directory given at compile time via --with-config-file-scan-dir .

I tried below code but couldn't set the environment variable PHP_INI_SCAN_DIR

        <?php
            $_ENV['PHP_INI_SCAN_DIR'] = "Jumbo";
            print_r(getenv());
        ?>

Someone please make me understand what exactly is PHP_INI_SCAN_DIR and how to use it/set it?

1条回答
爷、活的狠高调
2楼-- · 2020-07-24 05:18
查看更多
登录 后发表回答