I am trying to run the old codigniter2 website on windows 10 with a wamp server.
But I get the following error:
A PHP Error was encountered
Severity: Error
Message: Call to a member function get() on null
Filename: C:/wamp64/www/website.test/system/libraries/Cache/drivers/Cache_memcached.php:52
What should I do?
I solved my problem:
Step 1 (enable Memcache in WAMPserver):
If the steps above don’t work, you just open the error log file at the logs folder at the root directory and check the error there.
Step 2 (Changes in /system/libraries/Cache/drivers/Cache_memcached.php):
Using this github link, i made changes in Cache_memcached.php:
Replace this:
$this->_memcached = new Memcached();
With this:
if (class_exists('Memcached')) {
$this->_memcached = new Memcached();
}
else if (class_exists('Memcache')) {
$this->_memcached = new Memcache();
}
else {
log_message('error', 'Failed to create object for Memcached Cache; extension not loaded?');
return FALSE;
}
And replace this:
if ( ! extension_loaded('memcached'))
With this:
if ( ! extension_loaded('memcached') && ! extension_loaded('memcache'))
Then delete (if exists):
$this->_memcached->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
$this->_memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
And this (if exists):
$this->_memcached->setOption(Memcached::OPT_PREFIX_KEY, $prefix);
Step 3 (Refresh Database):