PHP and MySql – Setting up the environment

The first thing that you must have to start developing PHP applications is a development environment, there are two ways in which this can be achieved. The first way is to upload the files to your webhost, this is fine if you want to upload each file everytime you make an error, and dont mind having the restrictions from your web host. The other and by far the best way is to setup a local development environment., by doing this all of the files are stored localy and there are only the restrictions that have been set by you.

There are a number of development environments that you could install, but the one that we are going to install is xampp

Step 1: Download & install XAMPP

Go to http://www.apachefriends.org/en/xampp.html, and select XAMPP for Windows (or XAMPP for another OS if you don’t have Windows). Under ‘Download’, pick XAMPP. Now pick the EXE- or ZIP-file.

Step 2: Start XAMPP

Starting XAMPP is pretty easy. After you’ve installed XAMPP, go to Start Menu and start ‘XAMPP Control Panel’ from the folder ‘XAMPP for Windows’. Now you see a window with four start buttons. Push the start buttons at ‘Apache’ and ‘MySql’. If it’s OK, you should see two green boxes with ‘running’ in it next to the buttons. You could also check the ‘Svc’ checkboxes next to ‘Apache’ and ‘MySql’. This will install ‘Apache’ and ‘MySQL’ as services, so it starts with your operating system.

Step 3: Trying XAMPP

Start your favourite internet browser. In the address bar type ‘localhost’. This will bring you to the page of your local webserver (Apache in this case). Now you are on the standard XAMPP web page.

Step 4: Install a text editor

To make and edit your PHP files, you will need some kind of text editor. You could use Windows Notepad, but it’s way too simple in my opionion. I always use Notepad++ it has code highlighting. You can download the program here.