Class 'Memcached' not found


  • | 165 points

    Hi all, i have this error. Can someone help me. How i can install this in Laragon (full latest version).
    Thanks.

    Whoops, looks like something went wrong.

    1/1
    FatalErrorException in MemcachedConnector.php line 52:
    Class 'Memcached' not found
    in MemcachedConnector.php line 52


  • administrators
    | 43981 points


  • | 165 points

    i added this in my cache.php

    if (!class_exists('Memcached')) {
        include ("memcached.php");
    }
    // Different settings for local vs. stage/prod
    $memcachedServers = [
    	['host' => env('MEMCACHED_HOST', '127.0.0.1'), 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100]
    ];
    
    'memcached' => [
    			'driver'  => 'memcached',
    			'servers' => $memcachedServers,
    		],
    

    and now i have another error
    RuntimeException in MemcachedConnector.php line 34:
    No Memcached servers added.

    I started Memcached in Preference


  • administrators
    | 43981 points

    @DonikaV :
    Don't worry, you can do a quick fix by editing the file etc\php\pear\memcached.php
    Update the getVersion and add a fake getMulti() function like this:

    	public function getVersion() {
               return ['localhost:11211' =>  '1.4.5'];                                                          
    	}
    	
    	public function getMulti() {
    	     //TODO
    	}
    

    Then, your memcached code should work.


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.