How to run php file in wamp server in windows 10



PHP  installation

This PHP  tutorial we will learn PHP installation process step by step, and after installation learn how to create PHP script file and how to run or execute php script file on server.

Download WampServer Here : Downlaod Wampserver link

How to run php file in wamp server in windows 10
Download Wampserver

After successfully download Wampserver install setup run as administrator. 
After Successfully Installed Wampserver open wampserver as like below :

All Programs — >> WampServer –>> Start WampServer

How to run php file in wamp server in windows 10
Start wampserver

After start the Wampserver show the wampserver icon on taskbar near to clock icon at right bottom of windows screen.

Below menu you can Start All Services and Stop All Services of wampserver.

There is a top most option “Localhost”, which shows the server configuration.

How to run php file in wamp server in windows 10
PHP wampserver installtion

Now Click on “Localhost” you have below screen for server configuration. Verson configuration PHP version and Apache Server Version configuration which  we have already installed on our computer system.

How to run php file in wamp server in windows 10
PHP wampserver installation

Here, the “www directory” option define the path where we can save the PHP file.
The default location path is C:\wamp\www“.

We must save all PHP page at in “www” folder.

How to run php file in wamp server in windows 10
PHP wampserver installation

When we click on “www directory” option on above menu  it will locate directly to www folder in C drive. where we have to save all PHP file.

PHP Wampserver by default create a file index.php in www folder. Where we run the index file on browser it look like : http://localhost/index.php 

How to run php file in wamp server in windows 10
PHP File

Now, If you want to create new PHP file page, it must be save in www folder.
Suppose we create new file “meere.php”  in www folder. if we launch this file then we must write like :  http://localhost/meera.php

If we want to create new website with new name then create new folder with your website name in www folder like www -> MyWebsite. Now save all PHP pages in MyWebsite folder. If we want to  launch this pages we should write like :
http://localhost/MyWebsite/index.php.


Watch this php video tutorial for installation php process.

This php tutorial very help full for php beginners to install and setup php environment for php web development.

PHP was introduced in 1995. The full form of PHP at that time was Personal Home Page. But now it is known as Hypertext Preprocessor. PHP is an Open Source server side Scripting language which is embedded with HTML. PHP is generally used to develop dynamically web based application. PHP is very fast and easy to learn. It support almost all database like MySql(which is mostly used with PHP), oracle, MS SQL Server etc.

Compilation of PHP

Phalanger is a compiler which compiles the PHP code into Common Intermediate Language byte code and then this code executed by PHP Engine.


PHP Server installation (Wamp Server)

As we already know that php is a server side scripting language so we need server to run php code. There are many servers to run php program. If you are using Windows Operating System then you can install WMAP server which stands for Windows Apache MySql and PHP or Perl or python. It is a complete package or stack. And if you are using Linux Operating System then you can install Lamp which stands for Linux Apache MySql and PHP or Perl or python. XAMP is used for MacOS.

Here I am using WAMP server. When you installed WAMP server you will get wamp folder in your C drive. In this folder there is another folder name www. To run php code we have to put all php files in this folder. Php files having .php extension. We can use Notepad or Notepad++ to create .php files.


Hello Application using PHP

We can perform following arithmetic operator with the select statement:-

  1. Open the Notepad or Notepad++.
  2. Every php code written between the following code
  3. To print on the screen we use echo command.


<?php

echo 'hello Php';

?>
		

With echo you can use both single quotation and double quotation.

To execute this code save it with .php extension and save it in www folder.

C:\Wamp\www\hello.php

After that start the Wamp server then open any browser and type following code:-

http://localhost:8080/hello.php

Note:-8080 is port number. As I am using two Servers(IIS and Wamp) so that I have to change its port number. But if you are using only Wamp server then it will be 80. But if you have skype in your computer then you also have to change your port number by replacing the 80 to 8080 in httpd.conf file. Following is the way to open this file:-


How to run php file in wamp server in windows 10
Figure 1

Now Edit this file by replacing 80 with 8080 and save it.

How do I run a PHP file on Windows 10?

How to Install PHP.
Step 1: Download the PHP files. You'll need the PHP Windows installer. ... .
Step 2: Extract the files. ... .
Step 3: Configure php. ... .
Step 4: Add C:\php to the path environment variable. ... .
Step 5: Configure PHP as an Apache module. ... .
Step 6: Test a PHP file..

Can we run PHP in WAMP server?

PHP Server installation (Wamp Server) There are many servers to run php program. If you are using Windows Operating System then you can install WMAP server which stands for Windows Apache MySql and PHP or Perl or python.

How do I run a PHP file on localhost?

If you want to run it, open any web browser and enter “localhost/demo. php” and press enter. Your program will run.

How do I get WAMP to work on Windows 10?

Step By Step Guide to Install WAMP Server on Windows 10.
Go to the official WampServer website and download the Wamp server 32bit or 64bit..
Run the downloaded Wamp server.exe setup..
Select the location, if need to set it other than the default..
Follow the instructions and install the setup..