Last Updated: 28 Oct 2023
|
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
server-tech:macosx:install-memcache-on-mamp [Feb 18, 2011 11:32 PM] dordal |
server-tech:macosx:install-memcache-on-mamp [Oct 28, 2023 12:13 PM] 114.119.147.196 old revision restored (Nov 21, 2020 10:39 PM) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | = Installing memcache on Mac OS X & MAMP = | ||
+ | Installing [[http:// | ||
+ | |||
+ | **NOTE #1:** I'm using Mac OS X 10.6.4 and MAMP Pro 1.8.3 for the install. The instructions will also work for newer versions, such as MAMP 1.9, but you'll need to change some paths, because MAMP 1.9 introduced PHP 5.2 and PHP 5.3 as options (rather than PHP 4.11 & PHP 5.2), and thus rejiggered its internal structure. | ||
+ | |||
+ | **NOTE #2:** You'll need to download more than 3GB of software to make this work; particularly the [[http:// | ||
+ | |||
+ | === Downloading Software === | ||
+ | |||
+ | You need to download and install two things before you get started: | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | === Installing the memcached daemon === | ||
+ | |||
+ | There are two two parts to memcache you need to install: a daemon and a PHP client library. To install the daemon, use MacPorts via Terminal: | ||
+ | |||
+ | < | ||
+ | sudo port install memcached | ||
+ | </ | ||
+ | |||
+ | Once memcached is installed, start it up: | ||
+ | |||
+ | < | ||
+ | sudo memcached -u root -d | ||
+ | </ | ||
+ | |||
+ | === Installing the PHP client library in MAMP === | ||
+ | |||
+ | This is the hard part. In order for PHP to talk to memcache, it uses a PHP extension, which you must compile & install. | ||
+ | |||
+ | I've provided the memcache extension that I compiled; you //may// be able to drop this straight into MAMP's PHP extensions folder and then follow the instructions under [[# | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== Building memcache.so ==== | ||
+ | |||
+ | First, download the memcache sources. This is the easiest way: | ||
+ | |||
+ | < | ||
+ | pecl download memcache | ||
+ | </ | ||
+ | |||
+ | Extact the source & enter the '' | ||
+ | |||
+ | < | ||
+ | tar xvfz memcache-2.2.6.tgz && cd memcache-2.2.6 | ||
+ | </ | ||
+ | |||
+ | MAMP doesn' | ||
+ | |||
+ | < | ||
+ | ln -s / | ||
+ | </ | ||
+ | |||
+ | Now, from the '' | ||
+ | |||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Then run configure with this command: | ||
+ | |||
+ | < | ||
+ | MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=' | ||
+ | </ | ||
+ | |||
+ | There' | ||
+ | |||
+ | Once that's done, build the library: | ||
+ | < | ||
+ | make | ||
+ | </ | ||
+ | |||
+ | Finally, copy the built library into your PHP extensions directory. Note that if you're building on MAMP 1.9 / PHP 5.3, these paths will probably be slightly different. The key part is to find where other PHP extensions are kept, and copy the new extension to that location. | ||
+ | |||
+ | < | ||
+ | cp modules/ | ||
+ | </ | ||
+ | |||
+ | ==== Enable & Test memcache.so ==== | ||
+ | |||
+ | Now, go into MAMP. From the File menu, choose 'Edit Template' | ||
+ | |||
+ | Stop & restart MAMP, to reload the new PHP5.ini file. | ||
+ | |||
+ | Click the ' | ||
+ | |||
+ | That's it! Your memcached daemon is running, and MAMP can talk to it. Happy developing! |