Open staabm opened 3 weeks ago
What's stopping you from temporarily commenting a line in the php.ini file?
I want to disable a/the extension(s) for certain subprocesses which are created e.g. via proc_open
without interfering with the global config which might be use by other processes at the same time
You can use an own php.ini (possibly copied from the global php.ini, and modified) either via -c
or via PHPRC
. Or you can use a php-cli.ini, or on Windows you have a gazillion options using the registry.
I agree there are multiple complicated options which kind of fix this problem.
my issue was asking about whether there might be a easy thing todo which works on all php supported platforms and works good for tools like phpunit which create maybe hundreds of subprocesses which each might need a separate copy of the php.ini with only a few extension not loaded, if done like suggested.
it seems there is currently no easy way todo it (especially not in a extension agnostic way) and thats the reason why userland hacks like composer/xdebug-handler exist (which are used in phpstan, rector and other cli tools but only work for xdebug)
I am fine with closing this issue, incase you think php is good enough in this use-case.
incase you think php is good enough in this use-case.
I'm not sure. I understand your use-case, but I'm also afraid that there are already too many possibilities to set INI options. Maybe a discussion on the internals mailing list is in order?
Description
when running php on the CLI its sometimes usefull to use the default config, but ignore only certain extensions. (e.g. because these extension bring a perf hit when loaded, like
blackfire
orxdebug
)atm its quite some work to invoke PHP via cli, with all the default settings but just a single extension not loaded. see e.g. composer/xdebug-handler which needs a lot of code to just make the use-case work for
xdebug
alone. I would need a similar thing forblackfire
(and maybe another one fortideways
).I manually tried using
php -n -dextension= ..<all loaded extensions here except xdebug>
but this does not work. (I think I would need to replicate most of the logic in composer/xdebug-handler)would this problem be more easily solved with a new cli option at php-src level, which would allow to use the default but disable certain given extensions?