To see where CLI settings are type
php --ini
It is possible that you will get this:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
which basically means you don't have any config files for CLI PHP version and you are running on default settings.
Luckily there is a first line which says where is a path located and where is PHP looking for this config. So all you need to do is create php.ini in that directory and add some custom settings.
To check current PHP config settings, just write this in terminal
php -i
this will list all the config values, so to find particular one, run in terminal the following
php -i | grep memory_limit
this will output settings for memory limit in CLI.