In the previous tutorial you learnt what PHP is, it’s latest version and uses of PHP. PHP is very easy to learn compared to other languages. 

First you have to download a development environment (XAMPP) for your preferred platform, Windows, Linux or Mac. After that a good PHP editor, I would recommend Sublime Text 3. 

How to install PHP 

To start PHP in your computer, you need to have a web host with PHP and MySQL. You can install them individually or you can use a pre configured package for your operating system.  XAMPP is the most popular pre configured package used for PHP development. To install web server directly on your PC, go to the Apache Friends site and directly download XAMPP For Windows or for  your desire platform. XAMPP is a complete package, it’s installation process is very easy and simple. The best thing about XAMPP is it also provides PhpMyAdmin administrative tool along with MySQL database, with which you can easily manage your databases using a web server. 

Installing XAMPP for Windows

Follow instructions to install XAMPP for Windows

  •  Download .exe file, click it to start installation

  • Click Next and select the component you want to install. By default it’s all checked, you need to uncheck few as for local server you don’t need all these components. 

You only need Apache, MySQL, Tomcat, PHP, PhpMyAdmin, webalizer. FileZilla FTP Server is not needed to perform tasks at localhost. Mercury Mail Server is also not needed as it’s an email server. Perl, a high level programming language you don’t need it to install. 

  • Next step is to select your desired location where you want to install it. Click Next to begin installation. 

  • On the next screen click Finish to complete the installation process. 
  • You have successfully installed XAMP for Windows. Now you need to have a text editor. 

Installing Sublime Text 4

Sublime text editor is an excellent editor for coding and markup languages. It’s latest version is Sublime Text 4 with many new features. Go to the https://www.sublimetext.com/download and install latest version for Windows. 

  • Scroll down you will see download for windows 64 bit.

  • Double click on .exe file and click to install.
  • Select destination location, where you want to install sublime. 

  • Click Next, click Install. 

  • It  will take few seconds, after that click Finish and open sublime text editor. 
  • Here is how it looks.

Running a PHP File

To run a PHP File, first save it with .php extension in your project folder which is 

C: \wamp\www\project

And then you can run it on your browser. Go to chrome and visit the URL

http://localhost/project/example.php

In the next tutorial we will learn some basics of PHP syntax, so you can start writing your code.