PHP - PHP Hypertext Preprocessor is a server side scripting language. PHP programs will be executed only in the servers. So initially we need to make our computer as a local server. Lets follow the simple steps given below to run your php file in your own computer.
- Download Server software : xampp or wamp ( xampp demonstration is given below )
- Install the server software.
- Now open xampp control pannel from C:\xampp Location.
|xampp control Pannel|
- Now start Apache & MySQL.(To run basic php scripts, only Apache service is required)
- Open any one browser and type : http://localhost/
- Your xampp server window will be opened in your browser. If opened, you have successfully installed xampp server and now you can proceed with php program.
Run your first Php file:
- Open Notepad
- Copy and paste the above given code in the notepad
- Now save notepad file as filename.php
- One php file will be created in the location you have saved php file.
- Copy this filename.php file and paste it in C:\xampp\htdocs folder.
- Now open browser, and give URL as http://localhost/filename.php
- That's all...Success...You will get output as My first PHP script!
To Run php in wamp server
- Same as above given steps...small changes are given below
- Download and install
- Start wamp server -- > Start all services
- instead of saving php file in htdocs in xampp save in www folder for wamp.
- Same procedure for running php program in browser.