Installing Intl on PHP and MAMP

Compiling the Intl extension for PHP under MAMP is actually quite simple. I explain how and include a few solutions to “gotcha” problems along the way.

If needed, download the relevant ICU package, and extract it. Ensure your MAMP PHP binary is in your $PATH environment string. Snippet from StackOverflow:

Opening a Terminal to the extracted directory, I then compiled the code:

As I did not have autoconf, I installed it using Brew. Alternatively, you can compile it from source if you do not have Brew.

The next few steps are where I had some problems. I was getting strange errors:

fatal error: 'php.h' file not found
and
"ERROR: `phpize' failed"

Digging around, it turns out there’s a bit of a strange bug here. It can be quite simply solved by downloading/updating XCode from the App Store and symlinking the XCode SDK headers to the MAMP directory:

After this, simply install Intl using PECL:

If you’ve downloaded and installed XCode just now, you may get the error:

This is simply a MacOSX/XCode licensing issue. You can solve it by launching XCode or just typing:

to trigger the licence terms and agreements prompts. Afterwards, run the pecl install command again to install the extension.

Once that’s done, add the extension to your PHP config. In MAMP, this can be found under File > Edit Template > PHP > PHP 5.6.10. Add extension=intl.so to the list of loaded extensions.

MAMP should be restarted for this to take effect.

If you have any comments/questions, please leave them below!

Enabling memcache under MAMP

I know the tech is a bit old, but sometimes you need to make do with the tools you’ve been given. Here’s how I enabled memcache under MAMP.

First, grab the precompiled binary file (memcache.so) from here. There were no problems using this on Snow Leopard (for me, at least).

Second, copy the file to your MAMP extensions directory. You should be able to find it here: /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-[date].

Next, you’ll need to enable the extension in MAMP. Switch it off, then open up php5.ini by going to File > Edit Template > PHP5 php.ini

Find the extensions section (about line 540 or so) and add this line to the list of extensions:

Once that’s done, save php.ini and reboot MAMP. You should be able to see an entry for memcache when opening your phpinfo page.

Accessing local sites on VirtualBox

One of the most frustrating things about setting up VirtualBox for the first time is setting up a local host. It isn’t immediately obvious, and finding documentation was difficult. When you know how to get it running, it’s easy.

Here’s how:

1. Set up your VirtualBox image as normal.

2. On the networking tab, make sure you have the primary network adapter set to NAT

3. Boot your VirtualBox image and open your ‘hosts’ file using Notepad. This can be found at C:\Windows\System32\drivers\etc

4. Add your host entry as it is found on your main machine. In this example, I’m using the my site’s development copy ‘timneill.local’. See below.

5. Save the hosts file and enter your address into the browser. You should see your locally served site.

This was tested using Mac OS X and VirtualBox running WinXP. There is no need to flush the DNS cache for Windows after WinME.

If there are any problems, leave a comment or send me an email.

iRiver Story and Mac OS X

I acquired an iRiver Story recently, and couldn’t figure out how to mount the disk on my Mac OS X machine. The device didn’t automount, and it didn’t show up in the attached devices list.

A bit of scrounging led me to the solution:

  1. First, make sure the iRiver is plugged in.
  2. Power the device on, and wait for it to boot.
  3. When the prompt appears for charge or USB connection, choose USB connection.

The key thing to note here (and it was the problem I ran into) is that the prompt appears for about three seconds, which is barely enough time to figure out what you want to do with it. If you miss the prompt, simply unplug and re-plug the device.

© iRiver

As for document management… you can just drag and drop your files into the directories shown in Finder. You can (if you like) grab something like Adobe’s Digital Editions, but at the end of the day you don’t really need something so bloated to manage a handful of digital books.