![]() | 怎样改变配置选项以 Apache 模块方式运行 PHP当以 Apache 的模块方式运行 PHP 时,也可以通过 Apache 的配置文件(例如 httpd.conf)和 .htaccess 文件中的指令来修改 PHP 的配置选项。这样做需要“AllowOverride Options”或“AllowOverride All”权限。 在 PHP 4 和 PHP 5 中,有几个 Apache 指令可以允许在 Apache 的配置文件中修改 PHP 的配置。要得到哪些指令分别属于 PHP_INI_ALL,PHP_INI_PERDIR 或 PHP_INI_SYSTEM 的列表,请看 ini_set() 文档中的表格。
通过修改 Windows 注册表来改变 PHP 配置在 Windows 下运行 PHP 时,可以通过 Windows 注册表来修改每个目录的配置选项。配置的值存放于注册表的 HKLM\SOFTWARE\PHP\Per Directory Values 下面根据每个路径起名的子键中。例如对于路径 c:\inetpub\wwwroot 的配置值存放于 HKLM\SOFTWARE\PHP\Per Directory Values\c\inetpub\wwwroot。对于目录的设置将会在任何在此目录及其子目录下运行的脚本激活。对应键名应该和 PHP 配置选项相同并且具有字符串值。值中的 PHP 常量不会被解析。 其它 PHP 接口Regardless of how you run PHP, you can change certain values at runtime of your scripts through ini_set(). See the documentation on the ini_set() page for more information. If you are interested in a complete list of configuration settings on your system with their current values, you can execute the phpinfo() function, and review the resulting page. You can also access the values of individual configuration directives at runtime using ini_get() or get_cfg_var(). | ![]() | ||