douchuilai2355 2014-05-20 08:00
浏览 48

如何在小牛队上安装memcache? (MAMP)

I have MAMP on my machine, and I would like to install memcache for php, because one of my project throws errors like Fatal error: Class 'Memcache' not found.

I installed X-Code from appstore, and libevent, memcached, libmemcached with homebrew.


cd /tmp; pecl download memcached
gzip -d < memcached-2.2.0.tgz | tar -xvf -
cd memcached-2.2.0; phpize
./configure; make
sudo make install

Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20100525/

After that I copied and to my extension_folder:


and added extension = to my php.ini.

I still get fatal error.. what's the problem?

  • 写回答

1条回答 默认 最新

  • douba2705 2015-08-23 23:42

    How to install memcache and memcached on any version MAMP and on any version of php on LINUX/MAC by yourself?

    1. open a terminal
    2. install brew:

    ruby -e "$(curl -fsSL"

    1. brew install memcached

    2. brew install libmemcached

    3. start memchached (daemon) as you whish To have launchd start memcached at login:

    ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgents

    Then to load memcached now:

    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist

    Or, if you don't want/need launchctl, you can just run:


    1. download the SAME !!! VERSION of php source code from what you want to use with MAMP
    2. extract to /tmp
    3. configure -> make -> make install
    4. when "make install" ends you can see ON THE TERMINAL SCREEN !!! the paths where the php binary was installed on your system
    5. cd that path where your binary located
    6. pecl i memcache
    7. follow onscreen !!! instruction and copy
    8. if no instruction, which I doubt it then locate YOUR VERSION of php extensions directory/no-debug-non-zts... or copy to here on MAC

    /Applications/MAMP/bin/php/[PHP VERSION YOU USE!!!]/lib/php/extensions/no-debug-non-zts-20060613

    1. add to php.ini (the same version you downloaded and using with mamp) this line:;

    2. phpinfo(); and check memcached appears.

    OK ITS DONE !!! NOW -> have a beer :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档
  • ¥50 C++五子棋AI程序编写
  • ¥30 求安卓设备利用一个typeC接口,同时实现向pc一边投屏一边上传数据的解决方案。
  • ¥15 SQL Server analysis services 服务安装失败