When you use php commands through the terminal, it reads the system and not the local php.ini, therefore every setting locally is not read.
In order to enable the php command to read the local php.ini file along with its options, you need to add the path of that php.ini file.
For a list and help with php commands you have the command
php -h
To list the php.ini files and their locations which is loaded without specifying a path means the default one.
php --ini
Now we want to use our local php.ini
php -c /home/username/path/do/php.ini /home/username/public_html/file.php
In this part we have a php command that starts, -c which tells which php.ini file to use, and there you need to specify the entire path to your file if it is in public_html then it should be /home/username/public_html/php.ini and replace username with your username. And if some addon is a domain, then it is some other folder and the path to php.ini in that other folder. And after the php.ini part, there is a path to the file you are calling, as in our example file.php.
You have now launched the php.ini file from the desired location.
If you have more commands and use them often, so that you don't have to type the path every time, you can add a line to the .bash_profile
alias php='php -c /home/username/path/do/php.ini'
And now when you restarted php-ini it would show you the local php.ini file.
Also for other versions of PHP use instead of php use ea-phpXX (instead of xx you put the php version like say 74 80…)