Having set up the PHP memcache extension on my mac yesterday I now need the PECL memcached extension to use with Zend_Cache. This one was a little more involved than yesterday so here is a quick list of things you’ll need to do.
My first instinct was to use PECL to get the extension but doing that told me that there was an unmet dependancy so it couldn’t be installed. The missing dependancy was libmemcached, here’s what you need to do to get libmemcached setup:
First go to https://launchpad.net/libmemcached/+download and download the latest libmemcached (1.0.4 at the time of writing), once downloaded extract the archive and then open up a terminal window and cd to the new libmemcached-1.x.x directory. Now enter the commands below into the terminal window one at a time.
sudo make install
These commands will each take some time to run and while they are running you will see lots of output in the terminal window. What these commands do are ./configure configures the package for your system, make compiles the code into a binary that is usable by the system and sudo make install installs the built files onto your system (which in this case is moving the libmemcached library into place on your system).
Now that we have solved the dependancy issue we can now run PECL again:
sudo pecl install memcached
At the end of this process the script will remind you to configure PHP to use the new extension, if you are unsure on how to do this you can follow the end of yesterdays post – but dont forget to use memcached instead of memcache.
Today I needed the PHP memcache extension on my Mac OSX Lion 10.7.3 development machine for a project I’m working on. I was pleased to find out that this was a nice and easy one to get up and running.
Open up a terminal window and run the command below, this will tell PECL to download, build and install the extension.
sudo pecl install memcache
Now that the extension is installed on your system, you need to enable it in your PHP configuration file. On a standard system the php.ini file can be found at /etc/php.ini. Open the file and scroll down to the extensions section, at the bottom of this section add the line extension=memcache.so and then save and close the file.
After that, all that is required is for you to restart Apache and enjoy your new extension
Today I needed to set up the PECL UUID PHP module on my Mac OSX 10.7 Lion development machine, I needed it for a project that I’m working on.
My first reaction was to fire up terminal and run sudo pecl install uuid. It all looked good for a moment but then came to a grinding halt when ‘make’ failed.
Here is the error for reference (and for those searching snippets of it):
cc -I. -I/private/tmp/pear/temp/uuid -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootEEpqkn/uuid-1.0.2/include -I/private/tmp/pear/temp/pear-build-rootEEpqkn/uuid-1.0.2/main -I/private/tmp/pear/temp/uuid -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/uuid/uuid.c -fno-common -DPIC -o .libs/uuid.o
/private/tmp/pear/temp/uuid/uuid.c: In function ‘zm_startup_uuid’:
/private/tmp/pear/temp/uuid/uuid.c:89: error: ‘UUID_TYPE_DCE_TIME’ undeclared (first use in this function)
/private/tmp/pear/temp/uuid/uuid.c:89: error: (Each undeclared identifier is reported only once
/private/tmp/pear/temp/uuid/uuid.c:89: error: for each function it appears in.)
/private/tmp/pear/temp/uuid/uuid.c:90: error: ‘UUID_TYPE_DCE_RANDOM’ undeclared (first use in this function)
/private/tmp/pear/temp/uuid/uuid.c: In function ‘zif_uuid_create’:
/private/tmp/pear/temp/uuid/uuid.c:168: error: ‘UUID_TYPE_DCE_TIME’ undeclared (first use in this function)
/private/tmp/pear/temp/uuid/uuid.c:171: error: ‘UUID_TYPE_DCE_RANDOM’ undeclared (first use in this function)
/private/tmp/pear/temp/uuid/uuid.c:181: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘long int’
make: *** [uuid.lo] Error 1
ERROR: `make' failed
After a bit of googling I found out what the problem was and a solution to it. The full explanation and solution can be found here:
I can confirm that the patch and build worked on my set up (OSX 10.7 Loin) and I hope by spreading the word it some more people out.