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.

Then..

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 memcached.so and memcache.so to my extension_folder:

/Applications/MAMP/bin/php/php5.5.10/lib/php/extensions/no-debug-non-zts-20121212/

and added extension = memcached.so 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 https://raw.githubusercontent.com/Homebrew/install/master/install)"

    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:

    /usr/local/opt/memcached/bin/memcached

    1. download the SAME !!! VERSION of php source code from php.net 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 memcache.so
    8. if no instruction, which I doubt it then locate YOUR VERSION of php extensions directory/no-debug-non-zts... or copy memcache.so 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: extension=memcache.so;

    2. phpinfo(); and check memcached appears.

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

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

报告相同问题?

悬赏问题

  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签)
  • ¥50 sft下载大文阻塞卡死
  • ¥15 机器人轨迹规划相关问题