-
-
Save ryanjbonnell/3880048 to your computer and use it in GitHub Desktop.
# memcached requires libevent | |
cd /usr/local/src | |
curl -L -O http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz | |
tar -xvzf libevent-2.0.17-stable.tar.gz | |
cd libevent-2.0.17-stable* | |
./configure | |
make | |
sudo make install | |
# Compile memcached utility | |
cd /usr/local/src | |
curl -L -O http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz | |
tar -xvzf memcached-1.4.13.tar.gz | |
cd memcached-1.4.13* | |
./configure | |
make | |
sudo make install | |
# Create .bash_profile alias to start memcached as needed | |
alias m="memcached -d -m 24 -p 11211" | |
# Install autoconfig | |
cd /usr/local/src | |
curl -L -O http://gnu.mirrors.hoobly.com/gnu/autoconf/autoconf-2.69.tar.gz | |
tar xzf autoconf-2.69.tar.gz | |
cd autoconf-2.69 | |
./configure --prefix=/usr/local | |
make | |
sudo make install | |
# Compile and copy memcached.so module | |
cd /usr/local/src | |
curl -O http://pecl.php.net/get/memcache-2.2.7.tgz | |
tar -xvzf memcache-2.2.7.tgz | |
cd memcache-2.2.7 | |
phpize | |
./configure --enable-memcache | |
make | |
sudo make install | |
# If using MAMP | |
# cp modules/memcache.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/ | |
# emacs /Applications/MAMP/bin/php/php5.3.6/conf/php.ini # add line: extension=memcache.so | |
# If using Apache2 | |
# sudo emacs /etc/php.ini # add line: extension=memcache.so |
Line 33 corrections
cd /usr/local/src
curl -O http://pecl.php.net/get/memcache-2.2.7.tgz
tar -xvzf memcache-2.2.7.tgz
cd memcache-2.2.7.tgz
phpize
./configure --enable-memcache
make
make install
Lines 25 and 26 should be
tar -xvzf autoconf-2.69.tar.gz
cd autoconf-2.69
Also, @coreywebpt, you need to drop the .tgz on the cd command. It should be
cd memcache-2.2.7
Gist has been updated with all of the above feedback.
Awesome...this script worked like a charm.
still memcache is not working for me, when I write - whereis libevent
it gives no result, does that means that libevent has not been installed!!
gave this error
Memcache::get(): Server localhost (tcp 11211) failed with
I am on MAC OS X 10.8.3 (12D78)
Wouldn't it be easier to just do:
brew install memcached
Very nice.. this works perfect. Thanks.
@traday: that doesn't install the php extension. Also I think if you do install memcached through homebrew you also need to install libmemcached likewise.
More generally, the manual build of the extension as described here worked for me when pecl didn't. Configure flag I'm guessing. Thanks.
Nice. This works
Ops... I get this error at line 16 (make)
gcc -g -O2 -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -o memcached memcached-memcached.o memcached-hash.o memcached-slabs.o memcached-items.o memcached-assoc.o memcached-thread.o memcached-daemon.o memcached-stats.o memcached-util.o memcached-cache.o -levent
clang: error: argument unused during compilation: '-pthread'
make[2]: *** [memcached] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Any ideas?
Thanks
Def use homebrew instead
Thanks for this gist!
Just for the record if anyone needs it:
For my XAMPP installation I used the following to compile with the proper PHP binaries for my case:
curl -L -O http://pecl.php.net/get/memcache-2.2.7.tgz
tar -xvzf memcache-2.2.7.tgz
cd memcache-2.2.7
/Applications/XAMPP/xamppfiles/bin/phpize
./configure --enable-memcache --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
make
sudo make install
(I've installed libevent and memcached using macports and I used this code to compile the .so and add to PHP)
While running the make step of the memcached i am facing following error:
/Library/Developer/CommandLineTools/usr/bin/make all-recursive
Making all in doc
/Library/Developer/CommandLineTools/usr/bin/make all-am
make[3]: Nothing to be done for `all-am'.
gcc -g -O2 -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -o memcached memcached-memcached.o memcached-hash.o memcached-slabs.o memcached-items.o memcached-assoc.o memcached-thread.o memcached-daemon.o memcached-stats.o memcached-util.o memcached-cache.o -levent
clang: error: argument unused during compilation: '-pthread'
make[2]: *** [memcached] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Any suggestions on how to resolve this??
I'm also getting this -pthread error. That makes three of us.
Anyone can help?
@ecamaj actually four :)
Didn't find any solution to this compilation error, but I was able to install it via brew install memcached
I was building memcache
3.0.8 for PHP 5.6 from Acquia DevDesktop and I was getting error about incorrect architecture (also when I installed memcache
via brew
). The solution was to add "32bit" flags for the configuration script:
./configure --enable-memcache --with-php-config=/Applications/DevDesktop/php5_6/bin/php-config "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
The error I was getting was something like wrong architecture in Unknown on line 0 in MAMP
.
Line 33 should be "curl -O http://pecl.php.net/get/memcache-2.2.7.tgz"
Or phpize can't find config.m4