I have installed xampp for linux from https://www.apachefriends.org/index.html in my Ubuntu 22.04 OS
After successfully installed, my project is running fine but when I install the php-memchached in my system with the below command but it is not showing in my phpinfo() page.
Command:
sudo apt-get install -y php-memcached
Also I tried with the code to check my Memcached Successfully installed or not. But I got the error message that Class 'Memcached' not found
Code:
$memcached = new Memcached();
$memcached->addServer("127.0.0.1", 8080);
$response = $memcached->get("sample_key");
if($response==true) {
echo $response;
} else {
echo "Cache is empty";
$memcached->set("sample_key", "Sample data from cache") ;
}
Error Output in Yii console:
Class 'Memcached' not found
Please let me know how to install the php-memcached in Xappp for my ubuntu system?
php-memcachedextension uses thelibmemcachedlibrary to provide an API for communicating with memcached servers.So, This extension requires libmemcached client library.
The steps. Tried successfully from a basic ubuntu:22.04 image:
And xampp install:
Then, there are a lot of dependencies to install:
Or another possible install:
With your code:
Results:
And phpinfo:
Reference for more details:
https://www.php.net/manual/en/book.memcached.php