PHP language is most used technology when it comes to developing websites or web apps.
Frontend as it sound is all about the appearance and interactivity of web pages and the backend is about processing data, logics, etc.
Let’s consider an example of a contact form:-
How form will look is frontend and how the data of form will handled after submission is work of backend technology.
You can either install Apache or Nginx either one can be used to run PHP.
There are some pre-built solution to run a web server on your computer or laptop, here are those:-
Note – XAMPP runs MySQL so don’t get confused with the MariaDB.
As I have Macbook Pro 13 (2018 touch bar), I will be guiding you to install XAMPP on MacBook Pro but you can use same instructions with Linux as well as Windows.
First go to https://www.apachefriends.org/download.html and download XAMPP based on your OS and hardware architecture. I am going to download the following version “7.0.26 / PHP 7.0.26” which you can directly download by clicking here.
Once you XAMPP is installed just click on it and installer wizard will start. Follow the steps as they are very easy.
That is really simple, isn’t it? Let get started with Hello World application.
Locate the “htdocs” directory in your system. It most likely will in following address /Applications/XAMPP/xamppfiles/htdocs/ if you are OS X user if now you can use search on window or Linux to find.
Once you located the folder you need to create a file with .php extension. .php extension is important because it tells server to execute this file as PHP so if you have .html extension then all the code you write on php will simply print instead of executing through server. Don’t worry you can use all html elements inside .php file.
I have created hello.php inside htdocs folder and now here is code to print “Hello World”
<?php echo "Hello World";?>
Now run php by opening following url in your browser – http://localhost/hello.php
and we are done with hello world program in PHP, after exploring a little more PHP you should follow my other article on how to install wordpress on localhost
Hope this article helped, don’t forget to comment, share and subscribe.