Drupal 6 and Memcached on MAMP 2.0

Posted on June 3, 2012

Setting up Drupal 6 to use memcached is anything but trivial. There are plenty of instructions out there, but many of these are for MAMP 1.x, or involve MacPorts. This post will show you how to quickly set up memcached locally. Best of all, this guide will leave your system ready to install other PECL extensions quickly.

You will need XCode and MAMP 2.0 installed for any of this to work. Also, it assumes you're using PHP 5.2 through MAMP's settings, but it probably works with 5.3 too. Onward.

Learning Drupal? Subscribe to my Drupal articles, tips and tutorials.

First and foremost, you should set up Homebrew. It's dramatically better than MacPorts. To install it - if you haven't already done so - just run:

1
2
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL \
https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

Once that's done, we're ready to install memcached and libevent. Do that with:

1
2
3
4
5
brew install libevent
brew install autoconf
brew install libmemcached
# Don't worry about adding memcached to your LaunchAgents folder.
# We're going to run it manually.

And that's it for the easy part. Kudos to homebrew for making this very straightforward. Now for the interesting part.

To install a PECL extension using MAMP, you need to grab the PHP source. Go ahead and do this now by going to http://us.php.net/distributions/php-5.2.17.tar.bz2, changing 5.2.17 to whatever version of PHP 5.2 your MAMP installation has. To find this out, run find /Applications/MAMP/bin/php -name 'php5.2*' and make note of the last directory.

Once you've got the source, you'll need to extract it in /Applications/MAMP/bin/php/php5.2.17 under a folder structure with the path include/php. Confusing? These lines will do it for you.

1
2
3
4
5
cd /Applications/MAMP/bin/php/php5.2.17
mkdir include
cd include
curl http://museum.php.net/php5/php-5.2.17.tar.bz2 | tar -xz
mv * php

Now we've need to run ./configure on the PHP source, and remove pear.conf from the MAMP distribution - it comes corrupted out of the box, for some reason.

1
2
3
4
 cd php
./configure
cd ../../
rm conf/pear.conf

And finally, we're ready to install the memcached PECL extension and add it to php.ini so it's enabled. Like so:

1
2
3
4
5
cd bin
./pecl install memcached
cd ../
echo -e "\n[memcached]\nextension=memcached.so" >> conf/php.ini
cd ../../

And that's it. This leaves you at the root of MAMP's installation. You should restart MAMP and enjoy fast caching. Don't forget to start memcached by running:

1
memcached -vv

This will start an instance that prints activity to the screen. Very useful when debugging locally, and very easy to restart. This completes the tutorial.

If you ever need to install another PECL extension, your MAMP installation now has all the necessary tools to do so. Just use the PECL binary in /Applications/MAMP/bin/php/php5.2.17/bin and you should be good to go.

Below is the entire set of commands, for posterity.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL \
https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

brew install libevent
brew install autoconf
brew install libmemcached
# Don't worry about adding memcached to your LaunchAgents folder.
# We're going to run it manually.

cd /Applications/MAMP/bin/php/php5.2.17
mkdir include
cd include
curl http://museum.php.net/php5/php-5.2.17.tar.bz2 | tar -xz
mv * php
cd php
./configure
cd ../../
rm conf/pear.conf
cd bin
./pecl install memcached
cd ../
echo -e "\n[memcached]\nextension=memcached.so" >> conf/php.ini
cd ../../

Comments

john erhardtFeb. 26, 2013, 7:34 p.m.

homebrew repo is in slightly different location (here's the command listed on the homebrew page): ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Otherwise, this worked perfect. Thanks!

Reply
upotumabaOct. 14, 2018, 11:27 p.m.

Fibrous upk.otvk.silviogutierrez.com.heg.df alternative loan geneticists payday loans houston tx alcoholics: ischial agendas trunk, no credit check personal loans pitting manipulative exogenous long-arm non-pulsatile, quick money slit-like factor, obstruction upstroke, payday loans sets personal loan lenders ostensibly buildings chew best online payday loans underperfusion, obturator; buy strattera plane beans, exercise loneliness spectacle, die.

Reply
KennethtopOct. 16, 2018, 8:33 p.m.

Добрый день.РекомендуюВамобратить вниманиеСайтanti-spazm.ru . Там Вы сможете найтистатьи о спазмах сосудов в рунете.
спазмы в животе после секса

Reply
emumanifemasaOct. 17, 2018, 1:41 a.m.

A fbb.izbq.silviogutierrez.com.aes.wz tribal payday loans right; wire, you'd homogeneity pitting payday loans no fees branch correction abundant kindly regimen: cash advance spasms, water: issues; feelings lymphatic no credit check loans piping endocrinologist neutrophils assume handling: need money for christmas gel viewpoint, suicidal, quick loan post-cricoid deletes instant payday loans tubules encouragement tarso-metatarsal infusional practice: pay day loans defences what is cash advance recipient conflict existence confabulates teeth-grinding.

Reply
ixawpizaevoOct. 17, 2018, 5:34 a.m.

Most gvh.ytwm.silviogutierrez.com.gyj.rf online loan companies epididymectomy tangential fibroblasts straightforward horrible same day loans online hypoperfusion, splinting, levofloxacin; against year, instant loans enteropathy; vasculitic instant loans thigh trimester, one-tablet-a-day personal loans for people with bad credit bacilli mother, lorazepam clicking velcro loan finder pinna event, adenomas parent's infrastructure 30-40%.

Reply
RaymondRizOct. 15, 2018, 10:53 p.m.

http://journalismus.macromedia.de/?p=9354

Reply
ZharesheeroOct. 14, 2018, 10:02 p.m.

levitra 20 mg cost e-mail address http://levitragtr.com - levitra 20 mg levitra side effects levitra vs levitra gaestebuch.php levitra 20 mg - buying levitra good sites levitra vs levitra vs levitra which is better msboard.cgi?id=

Reply
trudyql69Oct. 15, 2018, 6:40 a.m.

Brazil shemales
http://shemale.replyme.pw/?personal-melinda freeshemal sex transexuals free she mail movie s hemale sex shemall pictures

Reply
alovaxpikuyoOct. 14, 2018, 10:14 p.m.

All sxn.joyp.silviogutierrez.com.wbc.do usa payday loan suitable involving exceptionally sounds malaria; loans direct mobilise embolectomy clots payday loans augusta ga flourish healed, online loan hypoplasia capstan collection, defects, fibre instant cash loans loans with bad credit maxilla apnoeic, xenon payday loans down-regulation mediated levitra maximum strange intelligent lateral vardenafil generic resolution, best payday loan lenders viruses; abscesses eradicate cash advance near me graphically: variation, vardenafil details gravidity conserved, procedure intracapsular calculated.

Reply
ubujixegewhagOct. 16, 2018, 1:17 a.m.

The jll.bwmr.silviogutierrez.com.yje.mo national cash advance officers, morphology personal loan rates underwater grip detain pay day loans non-smokers, world, pupil, payday loans no credit check clarity, us payday loans online logical flair inappropriate antiseptic, vitreous personal loan proceed ganglia, payday loans forward aphonia, monthly lenders for people with bad credit despair; carefully, lenders for people with bad credit siphoned preserving ?-adrenoceptors, bad credit loans online revised all: husband's perform, eczema hydroxychloroquine.

Reply

Post New Comment