Reputation: 2470
In the documentation for php.ini
, it says that "php.ini
is searched for in... [the] current working directory (except CLI)".
Why does it not read my .user.ini
file when running via CLI? Is there any way to configure PHP so that it always checks the current directory (or the directory of the script) for extra ini files?
I'm on OSX, running Homebrew PHP. My workaround is to run PHP like this, which does work (it picks up all of the regular ini files and also the one in the current working directory), but it's super awkward:
PHP_INI_SCAN_DIR="/usr/local/etc/php/7.0/conf.d:." php [options]
Is there any way to configure php so that this is the default behavior? Am I missing something?
Upvotes: 4
Views: 2932
Reputation: 781751
Set the PHP_INI_SCAN_DIR
variable in your .bashrc
:
export PHP_INI_SCAN_DIR=/usr/local/etc/php/7.0/conf.d:.
Then open a new Terminal window and it should use this setting.
Upvotes: 6