Jump to content

Memcache error: No servers added to memcache connection


Recommended Posts

Hello, i'm tuning a PrestaShop installation, and i found this error in the error_log:

[14-Mar-2017 15:14:25 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/cp22z7i2/public_html/classes/cache/CacheMemcache.php on line 52
[14-Mar-2017 15:14:26 UTC] PHP Warning:  Memcache::getextendedstats(): No servers added to memcache connection in /home/cp22z7i2/public_html/classes/cache/CacheMemcache.php on line 50

that corresponds to:

       $all_slabs = $this->memcache->getExtendedStats('slabs');

        foreach ($all_slabs as $server => $slabs)

I have my configuration in BO like this:




How do I have to configure memcache in order to work properly?


Or is this just a warning that I can ignore?



Link to comment
Share on other sites

Please take a look at the following link, it might help you fix the second issue in the error_log:



Regarding the first issue in the error_log (i.e. Wrong Invalid argument supplied for foreach) you can apply an IF statement. For example:


if ($all_slabs) {

--- Foreach loop goes here ---


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...