I have Memcache installed and working for PHP apps run through Apache (v2.2) but when I try to run a .php file in the command-line i get this error:
Fatal er
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.