logo

Finally, a Decent LAMP Development Environment

For years (as long as I've been a web developer) I've always had hobby sites I maintain, separate to what I do as a day job. Mostly they are built on the LAMP stack. Developing for LAMP has always been something of a geeky pastime for mine. All that SSH, FTP, Vi etc makes me feel like I've still "got it" and I enjoy the geek aspect of it.

Despite enjoying this geekery I often find PHP quite tiresome and frustrating.

First there's the development aspect. Developing with PHP and MySQL has always been a faff, whereby the process is: hand code the PHP/HTML in a text editor, FTP to a test server, take a look in browser. Repeat. FTP to live server when happy.

Then there's the maintenance side of things, which normally runs like this: get a request from a "customer" to update their site, wonder where the most up-to-date version of the site's file are (somewhere locally, test server or live server?), opt to just edit the file directly on the live server. Not good.

I've tried using Zend Studio in the past but not got on with it and I've always struggled on with my text editor and FTP client (FileZilla).

Struggle no more though. In steps Coda 2. Coda is brilliant! Web development as it should be - it seamlessly integrates the editing, previewing and uploading of website files. Watch the "coda tour" video on the website to see it in action.

Coda 2

Here's a plain HTML file being edited in Coda:

grab1

You can preview the same HTML from inside the app, like so:

grab2

Notice how it's using Chrome and I can therefore use the Chrome Inspector tools, all without ever leaving the Coda app.

Here it is coding a PHP file with a live-updating split-screen preview below. The site is database-backed and running locally on the Mac.

grab6

As I'm not a full-time PHP or MySQL developer I almost always forget all the functions and how to use them. In steps Coda's "Book" feature. You can pin searchable reference manuals to the top bar, like so:

grab3

I can now find out what the syntax is for functions like date() without having to Google it. Brilliant.

I love how the Files section maintains a list of modified files that need publishing, which I can do as and when I'm ready to.

grab4

Now, whenever I get asked to make a quick mod to a site I can turn to the Mac, launch Coda and have it done in a matter of seconds.

I doubt I've done Coda justice above. There's more to it than what I've covered (it has MySQL and Shell tools built-in too). There's also more to my new setup than just a copy of Coda. To make it a truly great dev experience you'll need the following:

MAMP Pro

We all know what LAMP stands for? Well, MAMP is Mac, Apache, MySQL and PHP. By installing MAMP on your Mac you can have a fully-functioning web server running locally. You can then point your Coda sites to the local VirtualHost you setup, as below:

grab5

I've added a separate Host for each of the sites I own/manage. MAMP uses local name resolution so you can have http://rockalldesign/ to test http://www.rockalldesign.com locally.

You might think installing MAMP would be a veritable nightmare of a Terminal job. It ain't. It couldn't be any easier if it tried. It downloads and installs like any other Mac app - just drag to the Applications folder.

Linode

For the last six years I've had a dedicated LAMP server with Fasthosts.co.uk. For the last five years I've had "Leave Fasthosts" on my to-do list. This last week I'm glad to say I have. I now have a Linode VPS. Linode is no nonsense hosting. You get a bare-bones Linux box with root access to the shell, through which it's down to you to add the A, M and P of LAMP. It's all very easily done and you end up with a blazingly fast web server.

Summary

I love this new setup. It's given me a renewed sense of excitement about what's possible and a will to learn some new stuff. I've not felt like that for a while. I just wish it were all available in such a nice package on Windows.

While I wouldn't want to use Coda full time, it is way, way better than using a plain text editor and there's no looking back for me. Buying Coda 2 and MAMP Pro is going to set you back about 100 GBP but it's well worth it IMO.

Comments

  1. Zend Studio is an overkill for simple sites, but it has project-wide autocompletion and function browser (Ctrl+click on a function and it opens its declaration even if it is in other file). Coda 2 also lacks a PHP debugger. When you don't need these features, Coda 2 may indeed be the most polished IDE.

      • avatar
      • Jake Howlett
      • Thu 31 May 2012 07:51 AM

      I'd imagine Zend Studio is the best choice if you make a living out of PHP dev (does anybody?), whereas Coda is just fine for us hobbyists.

  2. I have been using http://hetzner.de for dedicated servers. They are cheaper than Vps servers and the support seems ok

    I tried Vps servers 2/3 years ago and they were too flaky then. Also you can't run some domino licences on Vps - not that that is a worry here.

      • avatar
      • Jake Howlett
      • Thu 31 May 2012 07:52 AM

      Is there anything you don't know about Domino licencing Sean?

      Show the rest of this thread

    • avatar
    • Chris M
    • Thu 31 May 2012 08:11 AM

    Hi Jake, ever thought of using VirtualBox to run your LAMP environment. Comes with the added satisfaction of being the same OS as your target environment and with snapshots you can rewind if you found you've broken your setup. You'll need a beefy developer pc but I think it's worth it!

    • avatar
    • Chris M
    • Thu 31 May 2012 08:16 AM

    Was also going to say, of course you know where the live version of the source code is, in version control! :-)

      • avatar
      • Jake Howlett
      • Thu 31 May 2012 08:34 AM

      Version Control? Wadat? ;-)

  3. Thanks, Jake. My interest is likewise renewed with the knowledge of MAMP. Makes me think I'll give it a go as an education tool for me kiddos. They've more than mastered iOS already on their own.

  4. Splendid write-up. Coda 2 is pretty darned good from what I’ve seen so far. In the day job I’m doing all my PHP in Sublime Text 2 (another nice editor, cross-platform too!) against a linux app server running in VirtualBox. That’s quite nice too, as you can map your source directory on the host machine as the deployed app directory in the VM.

    Despite using the Zend framework a lot, can’t say I’ve ever tried Zend Studio. Is it based on Eclipse? If so, I’d be inclined to leave it and use one of these lighter editors. And who needs extensive autocomplete anyway? That’s what var_dump is for :-D

      • avatar
      • Jake Howlett
      • Fri 1 Jun 2012 02:13 AM

      Yep, Zend Studio is based on Eclipse. Always makes me wince a little every time I install yet another version of Eclipse. I reckon I must have had half a dozen Eclipses on my PC at some point.

    • avatar
    • Ferdy
    • Mon 4 Jun 2012 02:18 PM

    Jake, you probably know this, but I wanted to point out anyway that although PHP as a language has some frustrating elements, the development environment does not need to be. There's a lot of flavors available, but in my view the following are important:

    - Source control. Use git, subversion, whatever your preference. But use them. Even for personal projects. You will never go back. You can't complain about not knowing which version is where if you don't use a source control system, and that applies to every platform you develop for.

    - Remote debugging. Pretty much built-in in some other platforms, like .NET/Visual Studio, but in the case of LAMP you need to invest in setting it up. And you will be glad you did. Too many PHP developer are still "echo-ing" their debugging. Your productivity will increase dramatically using remote debugging. You are debugging a lot more than you think. Watch a developer all day, they're not writing new code, most of their time they're debugging.

    - Build/Deployment automation. This is advise that I don't follow myself I must admit, but if you often do (complex) LAMP deployments, invest in a build process to automate parts of it.

    Granted, the above things take some time to set up but you will be glad you did. Your development environment will be a lot more efficient, pleasant and reliable.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Thu 31 May 2012

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content