The recommended way to install a PHP extension is using PECL, here is an example. Run the following commands:
- pecl download memcache
- tar -xzf memcache-X.X.X.tgz
- cd memcache-X.X.X
- phpize
- ./configure
- make && make install
Then you need to enable the extension by adding the configuration to php.ini which usually is located in /usr/local/lib/php.ini
extension=memcache.so
After this, restart Apache.