How to configure the local development environment in Windows
Local environment in Windows with PHP, Apache and MySQL One of the first tasks that we, as programmers, must carry out is to configure our local development environment. This will obviously vary depending on the operating system that is running our development computer, the programming language that we are using for…
Local environment in Windows with PHP, Apache and MySQL
One of the first tasks that we, as programmers, must carry out is to configure our local development environment. This will obviously vary depending on the operating system that is running our development computer, the programming language that we are using for development, and the database system that we have chosen.
In this case I am going to explain how to configure a machine when we are running Windows7 64-bit and we want to program using PHP with Apache as our web server and MySQL as our database system.
We will also install a rich text editor to write our programs and scripts, and we will look at other applications and utilities that we will find useful in our daily work as developers.
Install a WAMP server
We can install Apache, MySQL and PHP separately, but fortunately there are solutions that can combine all three elements and let us to manage tasks and automate processes such as starting, terminating and restarting services. There are many options available to suit each programmer. I use WAMP, which is free and has 32 and 64 bit versions. If we are using Windows 7 64-bit, download and install the 64-bit version, Wampserver 2.5 64-bit PHP 5.5. A window will appear when we start the download to warn us that, among other things, we need to install Microsoft Visual C++ 2012 Redistributable (x64). You can get it from the previous link if you have not already installed it.
We start WAMP and check it is running correctly by putting the address http://localhost in our browser, which will look something like this:
Now in the Windows7 systray (icons next to the date and time) we will see a new WAMP icon, and when we left-click on it we will see options such as starting or terminating services, restarting them, exiting WAMP or checking the version and PHP and Apache modules.
Install a text editor or IDE
Our next task is to install a rich text editor or an IDE.
A rich text editor is similar to Windows Notebook, in the sense that it is a plain text editor that unlike programs such as Microsoft Word or Pages does not add any markers or additional data to the text. The main difference between Notebook and a rich text editor is that the latter offers a series of tools to make writing easier, such as advanced search, highlighting tags and key words or even modules for compiling our scripts directly. Examples of text editors are Sublime Text and Notepad++.
The other option is to install an IDE, which stands for Integrated Development Environment. These programs usually consist of an editor, a compiler and a debugger, which is a tool for finding mistakes in our scripts when they are running. Some examples of IDEs are PHPStorm, NetBeans, Eclipse and VisualStudio. Some of these IDEs are associated with programming languages.
Personally, I use Sublime Text and PHPStorm (which is not free), although I have also used NetBeans for specific projects, for programming in Java or VisualStudio to develop an app for the Windows platform and Windows Phone.
My advice is to try different options and use the one which you are most comfortable with.
Installing a database manager
WAMP offers us a database manager, PHPMyAdmin, which can be found at http://localhost/phpmyadmin/ or by left-clicking on the WAMP icon in the systray.
Basic tasks can be handled correctly by PHPMyAdmin but I advise you to install an advanced database manager such as MySQL Workbench, which has the advantage of being written in Java, so it can be installed and run on multiple platforms such as Windows or Mac OS X. The outstanding feature of MySQL Workbench is that it lets you manage both local and remote databases, but it also has many other features for importing data or user management.
Install a version control system and a graphical client
Despite developing locally and being the only component of our team, my advice is to always use a version control system like Mercurial or Git. We are not going to look into how it works, as it is not the subject of this article.
I use Git, which is free, and was developed by none other than Linus Torvalds (attention, everyone bow…). You can download the Windows version here.
As graphical client, for both Git and Mercurial, I would strongly recommend SmartGit, which is also available for Windows, Mac OS X and Linux. SmartGit enables you to synchronize repositories with services like GitHub or BitBucket.
A password manager is another useful tool to install, because many of our projects will require the creation of users for the CMS, databases, admins… etc. Trying to remember all these users and their passwords, and their URLs can drive you crazy. That’s why there are solutions that can encrypt and store all this data.
In my case, I have tried KeePass and Password Safe and I have finally opted for the first one. Their features include the creation of groups and folders, generation of passwords with different parameters and a time limit of 15 seconds to paste a copied password (ctrl+c) or user (ctrl+b) before it is erased from the clipboard, which will prevent you from putting a password in the wrong place.
In this article we have seen what you need for installing and configuring your local development environment in Windows, which is:
- Install an integrated development environment like WampServer
- Install a text editor or IDE such as SublimeText or PHPStorm
- Install a database manager such as MySQL Workbench
- Install a version control system and a graphical client like SmartGit
- Install a password manager such as KeePass
Make sure to read the next articles!