Install PHP development setup for Mac

Installing MAMP and writing your first PHP: Overview

There areĀ  three steps we’ll cover in this session:

  1. Get a text editors
  2. Install mamp
  3. Do a simple test

1. Get a text editor

Ok so if you want lo learn PHP forget Dreamweaver and other visual editors: they will only hold you back and slow you down. You will learn more by using a good text editor. And you might hear about IDEs like Eclipse and Netbeans; my experience with these is that they are big and slow and that they mess with my projects. I believe that using an IDE or a visual editor means I find myself learning about the IDE, and not so much the language. In any case I find that text editors give me more control and less headaches; so I recommend them over IDEs. Please read through my recommendations, and if you still decide to use an IDE then go for it.

There are many great text editors to choose from. I know that for most people price is important, so with that in mind:

Free editors

TextWrangler is the free version of BBEdit, and it is a great text editor, though really more of an all-purpose editor since it doesn’t do code completion (which is admittedly not a problem for everyone).

Also check out the paid editors below: all of them offer 30 day trials and all are good.

Commercial editors

Sublime Text – I use this every day for most of my coding and I love it. It is lightning-fast, and has great PHP language support (for syntax highlighting and code completion). Too many features to name here but there is a non-time limited trial so download it and see what you think.

TextMate – Before I switched this to Sublime Text I used this for everything. I switched because it seemed to have been abandoned for a while, and I was experiencing minor annoying bugs. But, on the other hand, TextMate won awards and has a great set of features. There is also a preview of the new version available now so that would be worth checking out.

BBEdit has been around since dinosaurs roamed the earth and is a very mature, stable editor. I have had a license for a long time, and even though I use a more language-savvy editor most of the time I still use BBEdit for certain things. For example: it’s great at opening massive files. I can open a 100MB log file in BBEdit no problem, where Sublime Text or TextMate would tend to slow down a bit. I did use BBEdit for PHP every day for a couple of years and it is great, but ultimately I was wooed away by the cool new features in TextMate (e.g.: code completion).

Chocolat is another editor that looks very promising. I haven’t used it but it seems to have a similar feature set to Sublime Text, which makes it worthy of attention. It has a built-in Live Preview for Markdown!

…If you are unsure which to try, go for Sublime Text since the trial has such great terms. I am not affiliated with any of these products; this information is just to help you get started.

Download and install your chosen editor. Usually installing means double-clicking the downloaded .dmg file and dragging the app into your /Applications folder.

2. Install mamp

Head over to mamp.info and download the basic version – ie the one on the left:
MAMP
Double-click the .pkg and run the installer. The default options are fine.

MAMP Installer

When the installer finishes, open your text editor of choice and type this into a new document:

<?php echo 'Hi!'; ?>

Save it as /Applications/MAMP/htdocs/index.php.

Open a web browser and visit http://localhost:8888.

You should see a very plain, unstyled greeting. Congratulations, you got PHP working and wrote your first script!

This post is part of PHP First Steps Tutorial. Go on to the next session: PHP language basics.

24 hr tutorial Hey!
Based on the feedback from readers of this tutorial series I’ve expanded, revised, and improved this brief intro as a whole book. It is much longer, so you get a more in-depth guide to getting started. As a result you’ll write better code. When you buy the book you also get a download password for all the source code from the tutorials. Build a functioning blog from scratch, and other useful mini-projects! Check it out »

No Comments

Be the first to start the conversation.

Leave a Reply

*

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>