How2Lab Logo
tech guide & how tos..


Getting started with PHP


To begin working on PHP, the first thing you would need to do is to setup a PHP environment on your own computer. Alternatively, you can get hold of a hosting account on an internet server which has PHP and associated applications installed and setup.

Working directly on an internet server can be a little tedious. Every time you make a change to a program, you need to upload the updated file(s) on the server and then run it to test it. For this you need to be connected to the internet all the time through a reasonably high speed connection.

Hence, my advice is that your must install all the necessary software on your local computer itself so that you can work offline during the development.

In my first article on PHP, I talked about the LAMP platform, which is short for - Linux Apache MySql PHP. In this article I will discuss how to setup a LAMP environment on your own computer to make it ready for PHP development. Since I am talking about installing PHP related core software on a Windows PC, I will call it WAMP, replacing Linux with Windows.


Preparing your PC for working on PHP-MySQL

To make your computer work like a PHP server, you just need to install some software that will make it function as a server. So, what are the software you need?

  1. Apache - Apache is a web server. On your windows PC, you will not use IIS, instead you will install an apache web server and use that. You would need to disable IIS on your PC so that you can free up port no. 80 to use it for Apache.
  2. PHP - Next you need a PHP server, which will pre-process all files with a .php extension before delivering to the web browser.
  3. MySQL/MariaDB - MySQL is the most popular database that works very well with PHP. It has also been time-tested to handle large size databases with ease. MariaDB is an enhanced, drop-in replacement for MySQL and is available under the terms of the GPL v2 license. MariaDB is kept up to date with the latest MySQL release from the same branch and in most respects MariaDB will work exactly as MySQL. All commands, interfaces, libraries and APIs that exist in MySQL also exist in MariaDB.

All of the above 3 come bundled as a single package known as XAMPP. If you wish to install with a MySQL database server, the link for downloading the same is https://sourceforge.net/projects/xampp/. Install the package that includes PHP version 5.6 or above.

If you wish to install the one that comes with MariaDB, you can install from the official website of XAMPP, viz. https://www.apachefriends.org/index.html. All relevant documents and help related to installation on different types of computers are available at this website. Hence, I am not dicussing those things here.


Step-by-step Installation Guide

Here is a step by step guide to setting up the PHP development environment on your Windows PC.

  1. Download XAMPP from the Sourceforge link mentioned above. Make sure to download the one with PHP version 5.6 or above.
  2. Click on the downloaded file to install. Do not start the Control Panel.
  3. Port no. 80 must be freed for running the Apache web server, and port no. 3306 must be freed for running the MySQL server. Make sure that you have disabled IIS (which runs on port 80) and stopped the IIS service from the windows Task Manager. Also, check that you do not have any previous MySQL server already running on your PC and using port 3306. If, yes, disable it and from the windows Task Manager stop any mysqld.exe process already running.
  4. Re-start your Computer
  5. Now, start XAMPP console. While installing, you would have created a shortcut icon for XAMPP. Right-Click that icon and run XAMPP in Administrator mode. Alternatively, you can start it by right-clicking at C:\xampp\xampp-control.exe to run it in Administrator mode.
  6. Now, your PHP development environment is all set. You should see a window somewhat like below:
  7. Test your XAMPP installation by opening a web browser and enter http://localhost/ in the address field. You should see the XAMPP default page.
  8. Now, open a second browser window and type http://localhost/phpmyadmin/ in the address field. This will open the phpMyAdmin interface from where you can create MySQL databases and tables.
  9. Congratulations! you are all ready now.

So, please go ahead and setup the PHP environment on your own computer. In my subsequent articles, I will be dealing with how to setup a website on your local computer and begin coding in PHP-MySQL.


Share:
Buy Domain & Hosting from a trusted company
Web Services Worldwide | Hostinger
About the Author
Rajeev Kumar
CEO, Computer Solutions
Jamshedpur, India

Rajeev Kumar is the primary author of How2Lab. He is a B.Tech. from IIT Kanpur with several years of experience in IT education and Software development. He has taught a wide spectrum of people including fresh young talents, students of premier engineering colleges & management institutes, and IT professionals.

Rajeev has founded Computer Solutions & Web Services Worldwide. He has hands-on experience of building variety of websites and business applications, that include - SaaS based erp & e-commerce systems, and cloud deployed operations management software for health-care, manufacturing and other industries.


Refer a friendSitemapDisclaimerPrivacy
Copyright © How2Lab.com. All rights reserved.