Logo

Thoom Technologies

  • Random
  • Archive
  • RSS

MAMP + Xdebug + Lion

In Part 1 of my MAMP + Lion series, I set up my MAMP installation so that I could use the included PECL installer. Then we installed OAuth. In Part 2, we installed MacPorts, then used PECL to install the ImageMagick “Imagick” extension. I decided to give you a breather and make this piece much simpler, so we’re going to install Xdebug. Originally this post was much longer since I didn’t think about checking for Xdebug until after I had already done a PECL install of the software. Perhaps in previous versions of MAMP this was a requirement, but with MAMP 2, the Xdebug extension has already been compiled. You just need to enable it.

Enabling Xdebug

To enable Xdebug, we need to edit the php.ini file. In this file, we need to uncomment the following line:

zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

And add the following two lines to enable an IDE or stand-alone application access to Xdebug:

xdebug.remote_enable=1
xdebug.remote_autostart=1

With these changes made, just restart the apache process and Xdebug should be enabled. Simple, right?

The Xdebug GUI

I use PHPStorm as my IDE and it comes with a nice zero-configuration Xdebug set up. Basically, I just tell the application to start listening on my localhost. If you want to use a decent free application, there is MacGDBp. Just download and install and you should be good to go. See, I told you this piece would be simple! In part 4, we’ll get back into the terminal and install PHPUnit.

    • #mamp
    • #lion
    • #php
    • #xdebug
  • 1 year ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

MAMP + ImageMagick + Lion

In Part 1 of my MAMP + Lion series, I set up my MAMP installation so that I could use the included PECL installer. In this piece, I am going to explain how to install the php imagick extension. It’s going to be a little more work, but it builds on the foundation established in part one.

Install MacPorts

To begin, I followed the advice given by Mike Leo @ Unreal Expectations on installing imagick on snow leopard. Basically, in order to use the imagick extension, you need to install the ImageMagick libraries. I tried a few different routes, and came to agree with his assessment: use MacPorts.

There are a few downsides to using MacPorts, but it mostly comes down to the fact that you have to install XCode 4.1, which is a time-consuming download. Fortunately, it’s free on the Mac App Store. After you install XCode, install the Lion MacPorts binary.

Once you have MacPorts installed, you need to install ImageMagick. On my laptop, this took a long time, so be prepared to wait :). This is done simply in the terminal:

$ sudo port install ImageMagick

Install PHP Imagick

After the MacPorts library has finished installing, the rest of the process will be easier than it was with MAMP 1.X since MAMP 2 is no longer a universal binary. This means you don’t need to follow Mike’s installation process. Instead, the next step is to install using pecl, providing the Imagemagick prefix /opt/local when asked:

$ pecl install imagick
...
Please provide the prefix of Imagemagick installation [autodetect] : /opt/local

Now just include the new extension in the php.ini file:

echo "extension=imagick.so" >> /Applications/MAMP/bin/php/php5.3.6/conf/php.ini

From here, we need to update one of the MAMP dynamic libraries because it is too old. It’s pretty simple, but took me a while to figure out. Next time, I’ll make sure to look at the php-error logs when an extension doesn’t load!

$ cp /opt/local/lib/libfreetype.6.dylib /Applications/MAMP/Library/lib/

Restart the Apache process and you should now have the Imagick library installed! Part 3 of this series will focus on enabling Xdebug!

    • #MAMP
    • #Lion
    • #ImageMagick
    • #imagick
    • #php
  • 1 year ago
  • 4
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

MAMP + OAuth + Lion

I recently updated my MBP to Lion and decided that while I was upgrading applications, I might as well upgrade my MAMP to version 2.0.1. When installing MAMP 2, make sure to choose the appropriate install. Since this article focuses on Lion, you should just choose the 64 bit version. I had hesitated doing this in the past since there are some unusual steps I had to take in the past to set it up. I had two extensions that I had to make work. The first was OAuth, since it is a key component to the project that I’m currently working on. Fortunately, installation was simple. To make things easier on myself, I added the following to my .bash_profile:

export PATH=/Applications/MAMP/bin/php/php5.3.6/bin:$PATH

This ensures that I’m using the correct php, pear, and pecl libraries. After adding that line to my profile, I run the following:

$ source ~/.bash_profile

which reloads the profile (You can also close the terminal window and reopen it if you really want).

Using PECL

We’re now prepared to install the PHP OAuth extension. Fortuntately, MAMP includes the PECL library, which means that we don’t have to compile it ourselves. We just have to run through a couple of items before we can do so. First, we need to have the PHP headers so PECL can install against the compiled library. MAMP provides all of the libraries and source code on the downloads page. Just look for a MAMP_components_X.X.dmg link. Once the image has been downloaded, open the image then find and uncompress the php-5.3.6.tar.gz file. By default this will create a folder called php-5.3.6 in ~/Downloads folder. We need to move and rename this folder. I did so via the command line with the following lines:

$ cd /Applications/MAMP/bin/php/php5.3.6
$ mkdir include
$ mv ~/Downloads/php-5.3.6 include
$ cd include
$ mv php-5.3.6 php

Now we need to have the header files built for our install. To do this:

$ cd /Applications/MAMP/bin/php/php5.3.6/include/php
$ ./configure

One last step, otherwise pecl will give us an error:

$ rm /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
$ rm ~/.pearrc

Installing OAuth

With this out of the way, installing OAuth is easy. In fact, it’s just 2 steps.

$ pecl install oauth
$ echo "extension=oauth.so" >> /Applications/MAMP/bin/php/php5.3.6/conf/php.ini

In part two of this series, I’ll show how to install the Imagemagick extension.

    • #oauth
    • #MAMP
    • #LION
    • #php
  • 1 year ago
  • 9
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
A web consulting and development company focused on LAMP technologies
  • Developer-Free Tumblr
  • thoom on github
  • RSS
  • Random
  • Archive
  • Mobile

© 2013 Thoom Technologies.

Effector Theme by Pixel Union