Setting Up a Local Web Server for PHP

Before we create the first program or dynamic web pages or websites in PHP. We should know about the local web server. Because we knew that PHP is server side scripting language.

It will be code executes on a web server. Also, we should have a basic knowledge of HTML and CSS.

Setting Up a Local Web Server for PHP

Before you start writing any PHP program we need about the local web server. Basically PHP script executes on a web server. The PHP Community Provides Some types of the local web server. These are the following:

  • WAMP Server
  • LAMP Server
  • MAMP Server
  • XAMPP Server

One of the above web servers must be installed on our computer. When we start learning PHP or creating the first program in PHP, a web server is installed on your system.

All these local web servers having PHP, MySQL, Apache and operating system base configuration file, it doesn't need to configure manually.

Web Server
Stands for
 WAMP Microsoft window o/s, Apache Mysql PHP. Click here to download and install WAMP Server
 LAMP Linux Operating System Apache Mysql PHP. Click here to download  and install LAMP Server
 MAMP Mac os Apache Mysql PHP. Click here to download and install MAMP Server
 XAMPP x-os(cross operating system) Apache Mysql PHP Perl. Click here to download and install XAMPP Server

Your First PHP Script

If you have installed xampp, you need go C:\xampp\htdocs\
If you have installed wamp, you need go C:\wamp\www

First of all, create your project folder where you have installed your web server and then inside the project folder, You will create a simple PHP file with any name you want to. Next,open up your favorite code editor and create a new PHP file then type the following code:

Now save this file in your project folder (located at C:\xampp or wamp \www\project), and view the result in your browser through visiting this URL:

http://localhost/project/filename.php.

Then you will see the output of this program like that

Output
Hello, World!

Hope you enjoy this tutorial. 

PHP