How to run a simple PHP Program Part - 1

This article shows the fundamental concepts and steps to run a simple PHP Program using WAMP as software in windows 10. PHP is a widely used scripting language and No.1 language used to create web portals and blogs.

What is PHP?

PHP - Hypertext Preprocessor is a server-side scripting language that runs on the servers like IIS, Apache. It is the topmost and widely used scripting language to build web portals and blogs. PHP is loosely coupled about data types. As PHP is an open-source scripting language, it is very easy to learn and experiment in our local desktop or laptop computer.

Why do we need to learn PHP?

As we are living in the computer age and slowly moving to the mobile world, there is a need for web application developers and API developers around the globe. The topmost websites like Facebook, Wikipedia, Yahoo, Flickr, Tumblr, Friendster, Sourceforge are built with PHP Script. i.e More than 75% of the websites in the globe are powered by PHP. Now you can understand the power of PHP!

Ready to code with PHP?

As the first step to learn PHP, We must have some set of software to be installed on our computer. If you are using windows operating system then you can use WAMP , XAMPP. In this tutorial, we are going to use the WAMP server. This WAMP server includes PHP, MySQL, Apache server together as a single bundle. Once you have installed WAMP server, start the WAMP server by double-clicking from the Windows start menu. Further, we will split the basic learning with 3 steps as follows.

Step - 1

Before going to the first step we will see some basic information about PHP. The PHP extension usually ends with .php and the current stable version of the PHP is 7.3.6 as of 30 May 2019.

Open C:/wamp/www or some times if the operating system is 64 then the public directory would be C:/wamp64/www. Create a new folder called web1 under the www directory.

Step - 2

The opening script tag for PHP is

The closing script tag for PHP is

So the fundamental script to display "Hello World" is below


echo 'Hello World! This is my first PHP Script!';


For PHP scripting you can use any text editors like SubLime, NetBeans for PHP or PHPStorm. But in this tutorial, I will show you using basic notepad because that is very easy for begginers. Now open a new notepad from start menu of windows or press Win+R and type notepad click "OK". Just copy the above code and paste in the notepad. Finally save the file into C:/wamp64/www/web1 and name it as index.php. Please note that the encoding must be UTF-8 as per the screenshot below.

Step - 3

The final step of our tutorial is to execute the PHP script that we have saved already under C:/wamp64/www/web1/index.php. As we already started the wamp server, just open any browser and type http://localhost/web1/index.php hit enter!.

Here you go! you could able to see the message Hello World! This is my first PHP Script!

Please find below for screenshot of the output

We will see the basic variables, Input and Output scripting in the next part of this tutorial with experiments.

Related Articles

How to prevent acne scars?

This article explains various measures which keep acne under control. This decreases inflammation and consequently chances of formation of acne scars too decreases. Actions like not picking at skin, proper hydration, using sunscreen lotions, proper skin care regime etc prevent formation of acne scars.

How To Control Anger?

Have you ever been angry and later on felt sad for being angry on some one or something? Do you want to control your anger ? Is anger good or not ? The following article will discuss about anger and measures through which we can control our anger.

How to remove blood stains from delicate fabrics and specific surfaces?

This article explains various tips and methods to get rid of blood stains from delicate fabrics like silk, satin, woolen, linen etc and from specific surfaces like concrete, hardwood floors, mattress, quilt, leather, carpets etc. These methods used can make them free from blood stains.

Top 9 tips and exercises to sharpen the mind and boost brainpower

The brain needs constant stimulation to remain alert and active. Practice good habits that can sharpen your memory and help you stay alert and on top of your game at all times. Simple lifestyle changes that involve the number of you sleep or what you eat or how you relax can play a great role in how your brain functions. Find out what you need to do right, to get the best out of your grey cells.

How to become a pathologist with top hospitals in India

Are you looking for a career in medicine as a clinical pathologist? Need to know how to start a pathology lab? This article provides complete information on the different specializations in pathology and a career guide on starting a career as a pathologist. You will also get a general idea on the approximate costs of setting up your own path lab.

More articles: How to


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: