How to install php-memcache on CentOS 6.x

fwh

Administrator
Staff Member
Joined
Dec 8, 2012
Messages
773
Points
63
To install PHP-memcached on your hosting sytem, firstly you must install memcached on the server. See link below to install memcached.

https://forumweb.hosting/13639-how-to-install-memcached-on-centos-6-x.html

How to install

1. Check memcached is existed on hosting server or not

Code:
service memcached status
For example

Code:
[root@server /]# service memcached status
memcached (pid  12314) is running...
2. Check php-memcached if it was installed or not yet


Code:
php -m | grep memcache
If yes, it will show this

Code:
[root@server /]# php -m | grep memcache
memcache
If not, it shows nothing and you can start install php memcache


3. Install php-memcache

Install packages to support for installing php memcache


Code:
yum install php-devel php-pear -y

Install php-memcache

Code:
yum install libmemcached-devel
Code:
pecl install memcache

Enable memcache

Check Loaded Configuration File by the command


Code:
php -i | grep php.ini
for example:

Code:
[root@server /]# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
Add module memcache into PHP

Code:
echo "extension=memcache.so" >>  /usr/local/lib/php.ini
or
Code:
Nano /usr/local/lib/php.ini
Adding

Code:
extension=memcache.so
Restart your web server to reload php.ini

Code:
Service httpd restart

4. Check php-memcache module is working or not


Code:
php -m | grep memcache
It should show this


Code:
[root@srv /]# php -m | grep memcache
memcache
If the result is memcache then you successfully install memcache module to PHP

You also can check by using phpinfo() and you can see it in your browser like this

php-memcache-module.png

Hope it helps!
 
Older Threads
Replies
4
Views
3,726
Replies
3
Views
3,780
Replies
1
Views
2,462
Latest Threads
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top