Installing Memcache Extension for PHP

Let’s determine the PHP version installed and also make sure it is in system path.

1. type php -v on you shell, it should show something like PHP 5.2.6 (cli) (built: some date)
2. type whereis php to get the path where PHP is installed in your system.
3. In your accounts home directory create/edit ‘.profile’ file and add ‘export PATH=$PATH:/usr/local/bin‘ where ‘/usr/local/bin‘ is the folder where php executable is installed.

Install PEAR, type following sequence of commands on your shell

1. wget http://pear.php.net/go-pear -O go-pear.php
2. php go-pear.php and follow the installation instructions
3. ls -l ~/.pearrc
4. edit the ‘.profile‘ (again) and add export PATH=/home/yourname/pear/bin:$PATH

Finally Install Memcache

1. type pecl install memcache on your shell, it will install memcahce extension for PHP.

Edit php.ini to add ‘extension=memcache.so‘, to find the exact php.ini file used by your system

1. php -i | grep ‘php.ini’

Restart apache, and you are done  type one of the commands below to do that

1. /etc/init.d/apache  restart , or
2. service httpd restart