-c /path/to/custom/php.ini
is an option passed to the PHP parser, interpretator and other internall stuff before even starting your script.
/path/to/script.php
is an actual argument passed not only to the PHP executable, but to your script.
Following arguments like /usr/bin/php -c /path/to/custom/php.ini /path/to/script.php A B C
would also be passed to your script.
Unfortunately the -c
option is not one of them.
You could get the used php.ini
file within the executed PHP script by using get_cfg_var
.
echo get_cfg_var('cfg_file_path');
If you are passing the -c
option you would get the path to your php.ini file. Otherwise you would get the default php.ini file.