text: Q:
  
  How to change the path for additional php.ini files
  
  If I run php --ini,then I get the following warnings.
  Cannot load Xdebug - it was already loaded
  PHP Warning:  Module 'memcached' already loaded in Unknown on line 0
  ....
  Configuration File (php.ini) Path: /opt/Qapache/etc
  Loaded Configuration File:         /opt/Qapache/etc/php.ini
  Scan for additional .ini files in: /opt/Qapache/etc
  Additional .ini files parsed:      /opt/Qapache/etc/php.ini
  
  Yeah, i run a Qnap NAS.
  If I comment out the modules in the php.ini like here, they will not be loaded anymore.
  So my thought is that the php.ini file is loaded twice by the path for "Scan for additional .ini files in:".
  I know that I can override the php execution with the following command
  php -c /PATH/TO/php.ini -n so it looks like this.
  Configuration File (php.ini) Path: /opt/Qapache/etc
  Loaded Configuration File:         /PATH/TO/php.ini
  Scan for additional .ini files in: (none)
  Additional .ini files parsed:      (none)
  
  And that works, none module was already loaded.
  But this is not persistent and I don't want to use the options for it every time.
  So, how do I change the path for Scan for additional .ini files in: in general?
  Thanks in advance.
  
  A:
  
  That directory is defined when PHP is compiled from source code using the custom flag --with-config-file-scan-dir:
  https://www.php.net/manual/en/configure.about.php#configure.options.php
  You can change it at run time by setting an ENV var called PHP_INI_SCAN_DIR as defined in the documentation:
  https://www.php.net/manual/en/configuration.file.php#configuration.file.scan
  
  