Looking for NEET / JEE Coaching? Enquire Now

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
<?php 

The closing script tag for PHP is
 ?> 


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

<?php

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.
notepad

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
browser_output

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


Related Articles

Zend Technologies launches PHP development cloud in 2011

Zend Technologies have announced their PHP development cloud infrastructure for making software services more easily and in a comfortable way. Since Zend is the world's fourth largest developer in PHP and they are making every inch as a competition to stand out in the world.

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.

Cake PHP - Development Framework For PHP

Here I describe the Rapid development framework used for PHP. By this article, you will be able to get more knowledge about the framework development in PHP. Here we clearly define the and principles used in cake PHP.

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.

More articles: How to PHP

Comments

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:
    Email: