php – How to connect memcached?


Good afternoon.

Memcache is connected. Working. How to connect memcached? Please tell me an example. Is there a need to register in the Apache or in php.ini? I write that it does not exist:

Fatal error: Class 'Memcached' not found

Thank you.


I'll leave a small instruction on how to install memcache because the topic seems to be relevant:

  1. Updating the repository:

    apt-get update

  2. Install the memcached daemon and module:

    apt-get install memcached php5-memcached

  3. Checking the launch of the daemon:

    netstat -tap | grep memcached

    tcp 0 0 localhost: 11211 : LISTEN 21448 / memcached

  4. Restarting the webserver

For apache2 :

service apache2 restart

For php-fpm :

service php5-fpm restart

Scroll to Top