Class 'Memcache' not found & PHP

前端 未结 6 1300
囚心锁ツ
囚心锁ツ 2020-12-10 01:44

I installed memcached by reading this article on Windows7 but unfortunately i keep getting error Fatal error: Class \'Memcache\' not found in D:\\xampp\\htdocs\\test\\

相关标签:
6条回答
  • 2020-12-10 02:25

    So i have looked now for a solution. Here you can download some compiled extensions.

    http://downloads.php.net/pierre/

    The problem is that at the moment there is no memcache extension for PHP 5.4. this is the problem why your extension could not be loaded. You need the extension for the correct PHP version and Tead Safe for Windows.

    So the easiest way is to work with PHP 5.3 if you need the extension.

    The newest version of memcache is the version 3.0.6 but its a beta version you can see it here.

    http://pecl.php.net/package/memcache

    You could try to take the beta version and compile it with your windows system. But its a lot of work.

    0 讨论(0)
  • 2020-12-10 02:28

    I found the working dll files for PHP 5.4.4

    I don't knowhow stable they are but they work for sure. Credits goes to this link.

    http://x32.elijst.nl/php_memcache-5.4-nts-vc9-x86.zip

    http://x32.elijst.nl/php_memcache-5.4-vc9-x86.zip

    It is the 2.2.5.0 version, I noticed after compiling it (for PHP 5.4.4).

    Please note that it is not 2.2.6 but works. I also mirrored them in my own FTP. Mirror links:

    http://mustafabugra.com/resim/php_memcache-5.4-vc9-x86.zip http://mustafabugra.com/resim/php_memcache-5.4-nts-vc9-x86.zip

    0 讨论(0)
  • 2020-12-10 02:28

    Memcached just uses standard text interface so its possible to use it without the module.

    // connect
    $link = fsockopen($host,$port,$errno,$errst,$timeout);
    
    // set
    $data = sprintf("set %s 0 %s %s\r\n%s\r\n",
                $key,$expire,strlen($value),$value);
    fwrite($link,$data);
    $result = trim(fgets($link));
    if ($result == 'ERROR') {
        // :(
    }
    
    // get
    $data = sprintf("get %s\r\n",$key);
    fwrite($link,$data);
    $line = rtrim(fgets($link)); 
    if ($line != 'END') {
        return rtrim(fgets($link));
    }
    
    0 讨论(0)
  • 2020-12-10 02:34

    xampp windows version is 32bit ,you must be use 32bit memcache.dll

    I hole that would be useful for you!

    0 讨论(0)
  • 2020-12-10 02:42

    Add this to your php.ini:

    extension="php_memcache.dll"
    

    and restart apache

    0 讨论(0)
  • 2020-12-10 02:44

    Also problem can be in loading another version of php module somewhere in apache .conf files. Need to check duplicated "LoadModule php..." directives and if that module compiled to correct version of apache. It seems sound simply, but not when you have several versions of php on one machine :) Or it can be SElinux problem too.

    0 讨论(0)
提交回复
热议问题