如何在PHP中设置和使用PHP_INI_SCAN_DIR环境变量? [英] How to set and use PHP_INI_SCAN_DIR environment variable in PHP?

查看:700
本文介绍了如何在PHP中设置和使用PHP_INI_SCAN_DIR环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在运行 Windows 10 的计算机上安装了 PHP 7.2.3 .我已经使用 XAMPP软件包的最新副本安装了PHP和 Apache httpd 4.29 .

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.

我从 PHP手册中发现以下内容

可以将PHP配置为扫描目录中的.ini文件 读取php.ini之后.可以在编译时通过设置 -with-config-file-scan-dir 选项.在PHP 5.2.0和更高版本中,可以通过在运行时覆盖扫描目录来设置扫描目录. PHP_INI_SCAN_DIR环境变量.

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.

可以通过将多个目录分开来扫描多个目录 特定于平台的路径分隔符(;在Windows,NetWare和RISC上 操作系统; :在所有其他平台上; PHP使用的值可作为 PATH_SEPARATOR 常量).如果在中给出空白目录 PHP_INI_SCAN_DIR,PHP还将扫描编译时给定的目录 通过-with-config-file-scan-dir 设置时间.

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 .

我尝试了下面的代码,但无法设置环境变量PHP_INI_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());
        ?>

请让我了解PHP_INI_SCAN_DIR的确切含义以及如何使用/设置它.

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

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆