With the presence of highly robust web applications such as Joomla, and WordPress (powering this very blog) making a real case for the power of PHP, I’ve decided to take the plunge and learn it. This means three things: I have to figure out how to get it running on my Mac OS X Leopard machine, I have to figure out a good editor with which to write code, and, of course, I have to learn to write PHP. Fortunately, I’ve begun to tackle each of these steps.
All the links I mention are listed at the end. So, if you like, you can skip my long-winded yet clever and witty editorial, and just get right to all the links.
Getting It Running Easily
One of the first challenges was to figure out how to get it working on my Mac. After following this tutorial on how to enable the version of PHP that comes with OS X Leopard, the Apache web server, and download the latest version of MySQL, and get them all working all together (I never quite did), I began to get discouraged, until, at the very end, it said, “If you find this confusing, you are probably better off with something like XAMPP or MAMP”. I found it all confusing, so I looked up MAMP.
MAMP (Mac, Apache, MySQL, PHP), as it turns out, is an all-in-one solution that gives you everything you need in one easy to use package. I had it downloaded, installed, running, and rendering PHP pages in fifteen minutes, all without editing Mac config files from the Terminal. Is this the most powerful, highly configurable method of setting things up? Not sure, at this point, but it couldn’t be an easier solution for someone just starting down the PHP road.
Finding an Editor
Two open source editors I’m playing with are TextWrangler, and PDT for Eclipse.
Think of TextWrangler as a more robust TextEdit. It’s a general text editor that also works for writing PHP. It’s simple, but has syntax coloring, and is easy to learn. I wrote my first PHP “Hello World” file with this.
PDT for Eclipse is a full IDE, meaning it has project file management, syntax coloring, and auto-completion, to name a few. Eclipse seems a little complicated at first, but I like this full-on IDE set-up. The only thing it’s missing, from my ASP.NET and Visual Studio influenced point of view, is a good HTML editor. (By the way, if anyone has any opinions on that – especially open source – leave a comment.)
Learning to Write PHP
This, of course, is the fun part, and the piece that will undoubtedly take the most time. That said, I found an excellent tutorial series that walks you through your first line of code, and introduces concepts to you in well organized sections. It’s easy to read, and almost entertaining at times (heresy for a tutorial, I know).
Of course, there’s the mothership PHP Home Page, with a wealth of knowledge, and an entire manual. This is great for reference, but as a newbie, I appreciated the bite-size approach to the PHP feast that the tutorial took. The reference manual provided by the PHP site is more of a heaping-choking-massive-mouthfuls approach, which is fine, once you’re ready.
So, I’m all set, and happily coding my first PHP pages, arrays, and foreach loops. I’m also trying to forget the gross eating analogy I just used. Maybe soon, I’ll be writing plug-ins for WordPress. Who knows? Hopefully, anyone else interested in learning PHP on their Mac will find these links useful.
Links
2 Comments
Write a Comment»I’ve been using WAMP for my development purposes for a few things and have not thus far been disappointing. I’m sure that it isn’t what you’d want to run for a full on server somewhere… but for a testing and debugging environment I think that it’s just fine given that you can have it up and running with MySQL in mere minutes.
I think I’m finally going to have to try out Eclipse… sounds to good to not at least give the old once over.
Reply
Kent Reply:
September 12th, 2008 at 12:41 pm
It’s nice to find those tools that let you concentrate on what you’re doing, instead of trying to configure a bunch of stuff to work together that you don’t even really know that well…yet.
I’m liking the PHP Eclipse IDE more and more (in the three and a half days that I’ve used it). It reminds me somewhat of MS Visual Studio. I just wish it had a WYSIWYG HTML editor. Oh well.
Reply
Very well written post however, I would recommend that you turn the No Follow off in your comment section.
Keep up the good work.
Reply