A script is called from command line using :
/fullpath/php -q -c /fullpath/php.ini /fullpath/script.php
I want it to use the normal php.ini and not the one for cli, but the -c flag is not working.
What could cause this ?
A script is called from command line using :
/fullpath/php -q -c /fullpath/php.ini /fullpath/script.php
I want it to use the normal php.ini and not the one for cli, but the -c flag is not working.
What could cause this ?
You can check which configuration files are actually loaded with the --ini
switch.
Here's what my normal configuration looks like:
krakjoe@fiji:/usr/src/php-src$ php --ini
Yields:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php-cli.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/apcu.ini,
/etc/php.d/auto.ini,
/etc/php.d/autostrict.ini,
/etc/php.d/ds.ini,
/etc/php.d/inspector.ini,
/etc/php.d/memcached.ini,
/etc/php.d/mongodb.ini,
/etc/php.d/mysql.ini,
/etc/php.d/opcache.ini,
/etc/php.d/pdo.ini,
/etc/php.d/uopz.ini,
/etc/php.d/xdebug.ini,
/etc/php.d/yaml.ini
Note that, it loads php-cli.ini
, because it exists and we are in cli
.
If we do this:
krakjoe@fiji:/usr/src/php-src$ php -c php.ini-development --ini
We get:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /usr/src/php-src/php.ini-development
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/apcu.ini,
/etc/php.d/auto.ini,
/etc/php.d/autostrict.ini,
/etc/php.d/ds.ini,
/etc/php.d/inspector.ini,
/etc/php.d/memcached.ini,
/etc/php.d/mongodb.ini,
/etc/php.d/mysql.ini,
/etc/php.d/opcache.ini,
/etc/php.d/pdo.ini,
/etc/php.d/uopz.ini,
/etc/php.d/xdebug.ini,
/etc/php.d/yaml.ini
This time php-cli.ini
was not loaded, the specified one was, but so were all the files in scan dir too.
Finally, if we do this:
krakjoe@fiji:/usr/src/php-src$ php -c php.ini-development -n --ini
We get:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /usr/src/php-src/php.ini-development
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
So, adding the additional switch -n
, stops PHP from using the scan directory configuration.