MacOsX Sierra上的ini文件在哪里?

2022-08-30 17:19:37

我剛買了新的 MacBook Pro。看看什么回报:php -i | grep ini

prompt> php -i | grep ini
Configuration File (php.ini) Path => /etc
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
Supported handlers => ndbm cdb cdb_make inifile flatfile
init_command_executed_count => 0
init_command_failed_count => 0
com_init_db => 0
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException
open sourced by => Epinions.com

这就是我跑步时发生的事情php --ini

prompt> $ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

似乎有当前的php没有加载任何php.ini文件。可能吗?


答案 1

当前版本的 Mac OS X 不附带 .PHP 对所有设置使用内部默认值。php.ini

在 中安装了一个示例配置文件。如果需要自定义 PHP 设置,可以使用该文件作为模板在 中创建配置文件。PHP 将从该文件中读取设置(如果存在)。/etc/php.ini.default/etc/php.ini


答案 2

编辑:以下方法已经过测试,我确认它适用于macOS,Linux和Windows的CMD和Bash

您需要在终端/ CMD / Bash中键入的所有内容是

php --ini

它将呈现如下内容:

Configuration File (php.ini) Path: /usr/local/etc/php/5.6
Loaded Configuration File:         /usr/local/etc/php/5.6/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.6/conf.d
Additional .ini files parsed:      (none)

推荐