Friday, January 30, 2009

The Ultimate Windows PHP Development Environment

So, you are a PHP developer and you have windows. You've tried all kinds of different editors and setups on your system, but nothing works the way you want it to. Well, your answer is here. I've compiled a list of applications that are essential for PHP development.

Hardware

A Computer - Developers do not need fancy machines to develop. They just need something within the past few years that has enough ram to run modern browsers and a bunch of apps open at the same time. I would suggest a minimum Windows XP. Vista will do as well.

2 Monitors - While a single monitor is nice, having a large area to work is also very helpful. What I suggest is adding a video card that supports two monitors. Then plug the monitors in side by side, and configure them.

The reason I suggest 2 monitors rather than having a wide-screen display is because I would suggest that you virtually stack your monitors so that one screen is virtually "above" another.

Why above one another? Simple. Programmers are lazy! 1) By having your monitors placed above one another you simply need to slide the mouse up to get to the second screen. The advantage of this is that the mouse never needs to leave the mouse pad. 2) Having the monitors setup side-by-side makes closing programs more difficult. If I have my browser maximized on screen 1 and I use the mouse to close it, I move the mouse to the right wall, go up to the x and click it.


Basic Software Tools

Browser(s) - Of course you need a browser or two. Being a PHP programmer doesn't always require that you have awesome xhtml/css design skills, but it's worth at least having several different browsers available to test your system on. There are a number of options available, however a simple set of browsers would be most useful.
  • Firefox - This is a Must! If you don't use firefox the only excuse you have is to be using Google Chrome. Other than that, there is No excuse. Firefox has a few nice extensions that make web programming helpful. Often times we will need to integrate PHP back-end with Ajax, or something. For testing purposes in this situation, it would be helpful to add Firefox Firebug.
  • Google Chrome - As mentioned earlier, Google Chrome is a good alternate to firefox. It is still relitavely new, but has some good potential.
  • Internet Explorer - Ok, yes you need it. Not for browsing, but for testing. It is useless to have a site that looks great on Firefox when 90% of your users are using Internet Explorer. In addition to this it is important that you have multiple versions of IE. I would highly suggest: Multiple IE.
PHP Editors - I'm certain this may be one of the more contriversial sections of this post because everyone seems to have their own preferences for editors. However since I'm posting this, my editor picks are best. :-p You need different editors for different reasons. There are two primary editors I use for different reasons.
  1. Notepad++ - This is by far the best editor I've used in a long time, and it is my favorite. Why you may ask? I judge editors by a number of factors. 1) How little memory they use 2) Easy to use Tabs 3) Highlighting 4) Useful features. Notepadd++ has ranked #1 for all of these factors in my book. Here are a few things I like about it.

    - The Light Explorer plugin makes browsing my directories quick and easy.
    - It comes with the ability to edit files directly on a web server through the ftp_syncronize plugin
    - It opens very fast, takes very little memory, has nice highlighting, and tabs at the top.
    - It opens and closes function tabs letting me see only the code I'm working on at the time.

  2. gvim for Windows - Before coming across Notepad++ I used gvim for windows exclusively. Why? Having a background of using the command line, I learned Vi. When you ssh over to a server and need to edit a file, Vi is by far the best editor (sorry emacs lovers). Well, since I'm always using :wq or %s/.../../g and other vi commands, I found that using VI in a windows environment was great. It allowed me to quickly edit files and use my favorite vi commands.

    Why did I switch? Mainly because of tabs. While I know the basics of VI, I never could setup a good solution for adding and managing tabs. I know there is a VI solution, but I fell to the temptation of opening 10+ Vi windows while working on a project. The transition to Notepad++ was a careful one, but I still keep Vi around.

    Why should you consider keeping Vi around?
    - It again is light weight and fast.
    - It offers nice highlighting.
    - It's VI! So you have the great features of VI.

    What can you use it for?
    - Various projects with CSV Files or Excel files. For instance you can turn an excel sheet into a csv file by copying the data to VI and running the following command:

    %s/\t/,/g

    - Vim is great and fast for formatting data quickly and on the fly.
    - The latest version of VI can open very large files quickly.

    Oh, and don't forget, it's VI!
Other Editors - for those of you who are just getting into PHP or if you need help for function names, or if you want to pay for your editor, I suppose you could use apps like Dreamweaver or SciTE or Eclipse with PHP.

The Applications

PHP, MySQL, Apache - This is commonly known (on windows) as WAMP installation. You will need three basic applications for 90% of your PHP development.
  1. PHP - Of course you will need PHP. This is the application that you actually use to run the code you're developing. I would suggest keeping a browser open and making use of the PHP function search box on the top of the php site. I would not suggest installing php alone on your machine unless you have the time to configure it yourself. (see below for xampp installation)
  2. Apache - Apache is the most popular and most stable webserver out on the market. It is worth learning, because if you go to work for a new company, chances are that their web servers use apache. (again, see below for installation)
  3. MySQL - There are a number of databases out there, but by far, mysql is the best for mid or even high traffic sites. For many years it has been second to Oracle, but recent versions have made it highly competitive to Oracle. And of course, you can't beat the price
So what is the best way to get these apps onto my windows machine? I've tried a number of applications that try to tie php, apache, and mysql into a windows environment where it is seamless and allows you to not have to install individual elements. By far, I have found that Xampp is the best of the best.

Xampp is an easy installation process that installs a fully working and functional WAMP server onto your system. It comes with a handy little control panel to allow you to stop and restart the apache and mysql processes. Not only that, it comes with PHPMyAdmin pre-installed to allow you to quickly get your database up and running. Note: Besides the default install, I would suggest making one additional modification to your xampp install. Open C:\xampp\apache\conf\httpd.conf in your favorite editor (Notepadd++ of course) and uncomment the line that starts with "LoadModule rewrite_module"... around 118 or so. This will turn on Mod Rewrite to allow a number of applications work with/nice/urls.

Frameworks

CakePHP - A while back I spent some time looking into frameworks. Out of all the frameworks I came across, CakePHP stood out above all the rest as a fast, reliable, well-designed framework. After spending a year and a half writing code in CakePHP, I've found that it is one of the most flexible frameworks I've used. Since then I've released over 20 sites using CakePHP that get hundreds of thousands of unique visitors per month. It has bee completely stable and reliable. It also has a growing community of developers who are constantly coming up with different uses, plugins, and add-ons.

Forgive me for not adding other frameworks, but feel free to explore your own.

Useful Utilities

VirtuaWin - This is a Must have. I keep a copy of this program on a zip drive in my wallet and install it on any computer that I'm using. Basically VirtuaWin allows you to have up to 20 desktops on your computer. You setup your shortcut key () to navigate to the desktop you are working. This allows me to work on several projects at the same time along with having one reserved for email and music controls. Once you use this, you'll never go back to a single desktop. Plus if you have dual monitors, you double your desktop capacity up to 40! Yikes!

CoreFTPLite - Of course you need an extra FTP utility. I found that Core FTP Lite does everything I want it to do. Fast loading, fast transfers, SFTP, doesn't crash, easy to use, etc. What else can you say? Filezilla is nice too.

Putty - Never go anywhere without putty. Putty is a small executable terminal window that allows you to ssh anywhere on the web. You don't install it, you just open it. I usually copy it to program files / putty and create shortcuts to it for consistancy.

RealVNC - If you have multiple windows computers and again you are too lazy to get up and log into that computer, VNC is the way to go. Vnc lets you open the desktop of another machine on your computer. It's a fairly simple setup, and works great.

Windows XP Tricks to save time - This is a video that suggests additional cool features to help you save time when programming on windows. I use a few of these techniques as well.

And Finally... The best for last...

Git

Git - I put git in its own category because it's so awesome and it is a must-have for ALL development. Git is a version control repository, but far better and faster than CVS or SVN. Git allows you to store snapshots of the files you are working on and easily recover bad changes. Take a look at one of my previous post about using Git with SVN for help in this area.


The End.


2 comments:

application development company india said...

Thanks allot for given this blog, it is a very interesting and useful articles in computerize environment There are two primary editors I use for different reasons.

anna harris said...

I think Alleycode HTML Editor is part of Windows PHP Development and its Freeware editor with syntax highlighting for both php and html.