nginx does not seem to load memcached module for php

6,176

I solved the issue. The only thing I had to do was restart php5-fpm
sudo service php5-fpm restart.

Found this in - https://insready.com/en/blog/building-nginx-microcaching-mariadbmysql-php-fpm-debian-6-apc-memcache-drupal-7-server

Share:
6,176

Related videos on Youtube

shyam
Author by

shyam

PHP, MySQL, Java

Updated on September 18, 2022

Comments

  • shyam
    shyam almost 2 years

    I have an Ubuntu machine with nginx and memcache running, and I'm trying to use PHP with Memcached. I'm getting Fatal error: Class 'Memcached' not found.

    The ini file is loaded from /etc/php5/fpm/php.ini, and all other additional .ini files are parsed, except memcached.ini (even after restarting nginx) as seen in phpinfo()'s output.

    output for phpinfo()

    I tried apt-get install php5-memcache and it completed without errors. However, pecl install memcached fails with the below error:

    In file included from /tmp/pear/temp/memcached/php_memcached.h:22:0,
                     from /tmp/pear/temp/memcached/php_memcached.c:47:
    /tmp/pear/temp/memcached/php_libmemcached_compat.h:5:40: fatal error: libmemcached-1.0/memcached.h: No such file or directory
    compilation terminated.
    make: *** [php_memcached.lo] Error 1
    ERROR: `make' failed
    

    The server has libmemcache in /usr/include/libmemcached, but even pecl install with --with-libmemcache=/usr/include/libmemcached fails.

    The output for php -i | grep -i memcache is as below:

    /etc/php5/cli/conf.d/memcached.ini,
    memcached
    memcached support => enabled
    libmemcached version => 0.44
    Registered save handlers => files user memcached 
    PWD => /usr/include/libmemcached
    _SERVER["PWD"] => /usr/include/libmemcached
    

    I'm not sure what else to check. Much appreciated if someone could help me out with something to fix this.

    Thanks!

    [UPDATE] Memcached is working from cli.

  • shyam
    shyam over 10 years
    I have installed Memcached, and not Memcache - adding the output for php -i | grep -i memcache to my question. But again, the ini loaded here is from php5/cli/ and for nginx is from php5/fpm/. I am not sure if it really matters, because the conf.d is the same.