Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Memcached error

askeeaskee New
edited July 2016 in Vanilla 2.0 - 2.8

config.php He added

$Configuration['Cache']['Enabled'] = true;
$Configuration['Cache']['Method'] = 'memcached';
$Configuration['memcached']['Store'] = 'localhost';

logs - error

[Sat Jul 02 07:50:39.532713 2016] [:error] [pid 9863] [client 109.---.---.---:50331] PHP Fatal error: Class 'Memcached' not found in /var/www/---/data/www/---.ru/library/core/class.memcached.php on line 58

Tagged:

Comments

  • @askee

    Have you enabled memcached on your web-server? It's not enough to simply add the lines to config.

    Please see here:

    https://vanillaforums.org/discussion/22848/cache-question-for-memcached

    and here:

    https://vanillaforums.org/discussion/31776/how-to-set-up-apc-and-memcached-caches-for-vanilla

  • askeeaskee New
    edited July 2016

    @whu606 said:
    @askee

    Have you enabled memcached on your web-server? It's not enough to simply add the lines to config.

    [root@askee ~]# memcached-tool 127.0.0.1:11211 stats
    127.0.0.1:11211 Field Value
    accepting_conns 1
    auth_cmds 0
    auth_errors 0
    bytes 179184
    bytes_read 336600
    bytes_written 4218064
    cas_badval 0
    ...
    serviceable

  • I'd suggest searching the error on Google; I don't think it's a Vanilla issue.

    See, for example

    http://stackoverflow.com/questions/11471977/fatal-error-class-memcached-not-found-in-my-path

  • LincLinc Admin
    edited July 2016

    You probably are missing the memcached module for PHP. Use php -i to check.

  • RiverRiver MVP
    edited July 2016

    although php -i calls phpinfo() and reflects your web server php setup.

    Some of the other php command line options don't reflect what is used by web server, so be wary of other command line options, they might not point to the php configuration that the web server is using.

    http://php.net/manual/en/features.commandline.options.php

    other php command line options actually may reflect different things and different ini files and not the web server setup of php.

    phpinfo will always give you a true idea of what your webserver sees.

    http://php.net/manual/en/function.phpinfo.php

        <?php
    
        // Show all information, defaults to INFO_ALL
        phpinfo();
    
        // Show just the module information.
        // phpinfo(8) yields identical results.
        phpinfo(INFO_MODULES);
    
        ?>
    

    you probably need the memcached.so file installed in your php configuration, the ini file pointng to it and your web server restarted.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited July 2016

    @Linc said:
    You probably are missing the memcached module for PHP. Use php -i to check.

    @River said:
    although php -i calls phpinfo() and reflects your web server php setup. Some of the other php command line options don't reflect what is used by web server


    although php -i calls phpinfo() and reflects your web server php setup
    I take this back, it is not true.
    On second thought I would NEVER use php -i from the command line to verify anything that is used by the web server. The reason why.

    You can have php linked to php5.5, php5.6, or php7.0 so if you run php from the command line it will run whatever version php is linked to.

    So you may may have php linked to php7.0 via a symbolic link, and at the some time you may have used a command a2dismod php7.0 to disable php7.0 for the web and a2enmod php5.6 which points your apache server at php 5.6.

    so php -i from the command line would return the info based on php7.0 config and could feasibly return that memcached is installed if you installed for php 7. but ....

    while if you use create a file (with contents below) called phpinfo.php and run it from your web server.

     <?php
    // Show all information, defaults to INFO_ALL
    phpinfo();
    // Show just the module information.
    // phpinfo(8) yields identical results.
    phpinfo(INFO_MODULES);
    ?>
    

    it will show the configuration for php 5.6 which may not have memcached.

    Command line php assumptions should not be confused with what php configuration your web server is using. unless you want to confuse yourself even more. While they may have similar modules and settings, they may not.

    you could have two twin daughters - alike in every way but. one loads up on Bacon and Eggs in the morning and the other may have cereal.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • LincLinc Admin
    edited July 2016

    It's a fair point, but @askee posted this to show how he checked for memcached:

    [root@askee ~]# memcached-tool 127.0.0.1:11211 stats

    That doesn't strike me as a junior developer approach to answering that question, so I assume he knows how PHP works. Also, if you're running nginx OR running Apache via CGI instead of the module, they can and should be the same instance of PHP.

    So yeah, if you're just stumbling into this discussion from parts unknown, it's more foolproof to use phpinfo(). Still feel pretty confident @askee can just do what I suggested.

Sign In or Register to comment.