Hello Friends, Today I am gonna make Hello World Program in PHP but before that we will setup WebServer. WebServer is needed because PHP not work without WebServer. WebServer parses PHP script into text/html and then sends this parsed response to client’s browser.
- Download WAMP from here (You can download XAMPP also or other web server you want).
- Now start installing procedure by double clicking on downloaded exe file and follow the steps which comes during installation.
- After completion of installation procedure find www folder in case of WAMP or htdocs folder in case of XAMPP, which would be basically C:/wamp/www or C:/xampp/htdocs in case of XAMPP.
(www or htdocs is the working directory where we put all our php, html, etc files)
- Now start server from start menu.
- Now open your browser and type localhost in address bar, if the server is running then you will see homepage of server. If server’s homepage not shown then make sure that server is installed correctly and running.
- Open notepad or any of your favorite text editor.
- Type or Copy the below code into the text editor.
test.phpPHP123<?phpecho "Hello World";?>
- Save file in www folder in case of WAMP server or in htdocs folder in case of XAMPP server and give it name test.php
- Now open your browser and type localhost/test.php in address bar of browser and press enter. And its done you have output of first program Hello World.
You may share if you like it