找不到PHP 5.4和Laravel类'Memcached'

Bil*_*son 15 php memcached laravel

我知道这里有大约10个这样的问题,但没有一个完全适合我.

完成的步骤:

  1. 安装内存缓存
  2. 安装了php memcache模块
  3. 更新了laravel配置以使用memcache
  4. 重启服务器

php信息结果:

memcache.allow_failover 1   1
memcache.chunk_size 8192    8192
memcache.default_port   11211   11211
memcache.default_timeout_ms 1000    1000
memcache.hash_function  crc32   crc32
memcache.hash_strategy  standard    standard
memcache.max_failover_attempts  20  20
Run Code Online (Sandbox Code Playgroud)

memcached-tool结果:

         accepting_conns           1
               auth_cmds           0
             auth_errors           0
                   bytes           0
              bytes_read          14
           bytes_written        1096
              cas_badval           0
                cas_hits           0
              cas_misses           0
               cmd_flush           0
                 cmd_get           0
                 cmd_set           0
               cmd_touch           0
             conn_yields           0
   connection_structures           6
       crawler_reclaimed           0
        curr_connections           5
              curr_items           0
               decr_hits           0
             decr_misses           0
             delete_hits           0
           delete_misses           0
       evicted_unfetched           0
               evictions           0
       expired_unfetched           0
                get_hits           0
              get_misses           0
              hash_bytes      524288
       hash_is_expanding           0
        hash_power_level          16
               incr_hits           0
             incr_misses           0
                libevent 2.0.21-stable
          limit_maxbytes   268435456
     listen_disabled_num           0
       lrutail_reflocked           0
            malloc_fails           0
                     pid       12022
            pointer_size          64
               reclaimed           0
            reserved_fds          20
           rusage_system    0.043400
             rusage_user    0.065101
                 threads           4
                    time  1421438137
       total_connections           7
             total_items           0
              touch_hits           0
            touch_misses           0
                  uptime        2607
                 version      1.4.21
Run Code Online (Sandbox Code Playgroud)

它在php -m中作为"memcache"

然而,当我进入php工匠修补匠并尝试进行任何缓存时,我得到了典型的 Fatal error: Class 'Memcached' not found in vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php on line 44

TL; DR;

我已通过多种方法确认安装了memcache.确认已安装php模块.仍然不允许我使用memcached类.

jua*_*on1 22

如果您在ubuntu环境中,请尝试使用以下命令安装Memcached:

sudo apt-get install php5-memcached

之后重新启动服务器

sudo service lighttpd restart

要么

sudo service apachectl2 restart

要么

sudo service nginx restart


Dan*_*ams 19

Memcache并且Memcached是两个不同的PHP扩展.Memcache是旧的已弃用的.Memcached是一个更新,完全支持的扩展.

查看http://pecl.php.net/package/memcached

您可能还需要安装libmemcached https://launchpad.net/libmemcached/+download


Niz*_* B. 8

apt-get install php-memcached
Run Code Online (Sandbox Code Playgroud)

解决了来自Laravel的"未找到类MemCached"的问题.