Mac OS X


How to Install Memcache on Mac OS X

Hopefully I’ll save somebody days of work here. If you’re on a mac, unfortunately you can’t just run “pecl install memcache” (well you can, but it won’t work). I’m using Zend Server CE, which is a 32 bit application and if you run the above command to install from pecl, you’ll get a 64 bit version installed. Oh, and let’s be clear, we’re working with Memcache and not Memcached (they are very similar, but different).

OK, how to make it work. Open terminal and run the following commands –

  1. cd /tmp
  2. pecl download memcache
  3. tar xzf memcache-2.2.6.tgz (or whatever file and version you downloaded)
  4. cd memcache-2.2.6
  5. OK, here is a tricky one. Copy this line and change the path on the end to the location of your phpize executable and paste into terminal.

    ./configure MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ –with-php-config=/usr/local/zend/bin/php-config

  6. make
  7. make install

Restart apache and you should be good to go.


Apache 2.2 “It works” message – vhost and hosts file

I recently switched from using windows to a mac. With windows, you can structure your hosts file like this

127.0.0.1 localhost
127.0.0.1 test.localhost

However, if you do this and you’re on a mac like me and go to test.localhost, you’ll get a “It works!” message no matter how your vhost is configured. The solution is to structure the hosts file for the IP address on a single line like this –

127.0.0.1 localhost test.localhost


Zend Server on Mac OS X phpMyAdmin import size problem

I just switched over from using windows for years to a mac. I installed Zend Server CE and when working with phpMyAdmin I needed to increase the upload limit in the php.ini file again so I could import a database. I modified the post_max_size and upload_max_filesize then restarted apache as I’ve done in the past. Phpmyadmin still said 2048kb max file size for the import. I finally found the solution here http://stackoverflow.com/questions/3958615/import-file-size-limit-in-phpmyadmin . Apparently phpMyAdmin is running under Lighttpd and has it’s own php.ini file located here /usr/local/zend/gui/lighttpd/etc/php-fcgi.ini . Modify the post_max_size and upload_max_filesize values in that file then restart apache. See my post on how to restart Zend Server CE apache on Mac OS X.