Presumably you have separate php.ini files set up for apache and the command line (cli).
If so, you need to add the following to your cli php.ini file:
extension=memcache.so
On Ubuntu it's in /etc/php5/cli/php.ini
If it's working then memcache should appear in the list of modules if you run php -m
on the command line.
Alternatively, you can create a file /etc/php5/cond.d/memcache.ini
with the same contents.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…