Location of the php.ini for CLI use

moostende

Verified User
Joined
Feb 19, 2009
Messages
9
Location
Netherlands
Hi,

Where can I find the php.ini for use during the Command Line Interface? In an out-of-the-box Ubuntu installation with multiple PHP versions it is found under /etc/php/7.4/cli/php.ini. However i can't find any in the DA installation:

# locate php.ini
/usr/local/php56/lib/php.ini
/usr/local/php71/lib/php.ini
/usr/local/php74/lib/php.ini
/usr/local/php81/lib/php.ini

The default PHP CLI uses version 8.1 however I start my CLI script with the specific version in it:

/usr/local/php74/bin/php /home/client/public_html/script.php
 
That is actually quite weird. The output suggests it uses the 'default' location as stated above:

# /usr/local/php74/bin/php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/php74/lib
Loaded Configuration File => /usr/local/php74/lib/php.ini

However I wanted to edit the .ini file to prevent all kinds of notices in the CLI, that I already disabled in the .ini file earlier (as in weeks ago), because it filled my web log files with a lot of rubbish. The log files are clean, so the configuration should be fine. Running a php file from the command prompt still shows all these notices.

Any ideas?
 
Running a php file from the command prompt still shows all these notices.
Running from the command prompt the default php version is used. You can use the php -v command to see what php version is running as default (is also the php1_release in options.conf).
Might be you did not edit that specific php.ini file and then the notices still will show.
 
how do you stop all kinds of notices error log ?

this is how I stop error logging.
Code:
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(0);

for cli, "error_reporting" should be enought.
 
Back
Top