【问题标题】:How to install Memcached on Xampp Mac如何在 Xampp Mac 上安装 Memcached
【发布时间】:2015-06-13 14:01:57
【问题描述】:

我需要在 XAMPP 中使用 Memcached,因为我需要在本地开发,而目前我看到的所有解决方案都不起作用。

Fatal error: Class 'Memcached' not found in /Applications/XAMPP/xamppfiles/htdocs/system/libraries/Session/drivers/Session_memcached_driver.php on line 108
A PHP Error was encountered

Severity: Error

Message: Class 'Memcached' not found

Filename: drivers/Session_memcached_driver.php

Line Number: 108

Backtrace:


//does not work, and actually i need this not the bottom one.
//keep in mind that the service is running, and everything was succesfully
//installed with brew

$this->_memcached = new Memcached();


//works
$this->_memcached = new Memcache;

【问题讨论】:

  • 对于 OSX -> 去下载 MAMP / MAMP PRO :)
  • 同样的事情...不起作用..我已经尝试过了:)
  • 更改端口,无法想象还有其他事情可以搞砸 mamp ;pp
  • memcache 在 Xampp 中完美运行,但是我需要使用“Memcached”,因为我使用的框架只使用了这个,这样我可以在性能方面升级我的 APP。我已经用 brew 安装了所有东西,它很好,服务也在运行,但在 XAMPP、MAMP 或其他任何东西中都不起作用。

标签: php macos terminal memcached


【解决方案1】:

这对我有用:

  1. 使用 brew 安装 libmemcached:

    brew 安装 libmemcached

  2. 使用 pecl 安装 memcached:

    • sudo /Applications/XAMPP/xamppfiles/bin/pecl install memcached

    • 当提示输入 libmemcached 目录时,按“Enter”,安装程序会自动找到它。
  3. 将 memcached 扩展添加到您的 php.ini 文件中:

    • sudo vim /Applications/XAMPP/xamppfiles/etc/php.ini

    • 将“extension=memcached.so”添加到文件中
  4. 重新启动您的 Apache 服务器(使用 GUI 或运行):

    sudo apachectl 重启

  5. 使用 brew 启动 memcached:

    brew services 启动 memcached

使用这些说明创建了gist。

【讨论】:

【解决方案2】:

找到了解决方案:)

brew install libevent
brew install autoconf
brew install libmemcached

//Download the PHP version you are using and past it to:
cd /Applications/MAMP/bin/php/php5.6.7/include/php

//Configure the source with
/Applications/MAMP/bin/php/php5.6.7/include/php/configure

//go to
cd /Applications/MAMP/bin/php/php5.6.7/bin

//compile memcached
./pecl install memcached

//go back
cd ../

//Add the memcached.so extension to your php.ini file
echo -e "\n[memcached]\nextension=memcached.so" >> conf/php.ini

//start memcached server
memcached -m 24 -p 11211 -d

//restart MAMPP and thats it!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-13
    • 2019-05-16
    • 2019-08-18
    • 2012-02-17
    • 2018-11-01
    • 1970-01-01
    • 2019-09-12
    • 1970-01-01
    相关资源
    最近更新 更多