In this tutorial, you shall learn how to create a PHP file in XAMPP folder, and run it on the server, to print a “Hello World” message in the browser window.

PHP Hello World

1. Start XAMPP and click on Open Application Folder.


There will be a directory named htdocs.

Go to htdocs directory

2. Open the directory, and create a file with .php extension, say helloworld.php.

Create a file named helloworld.php

3. Open helloworld.php with a text editor and write the following code in it.

Code in helloworld.php

4. Go to XAMPP application, and under Manage Servers, make sure the servers are running.

Start the servers

5. If all the servers are stopped, then click on the Start All button present on the bottom of the application.

6. Open a browser and hit the url http://localhost/helloworld.php

Print Hello World using PHP

We have run our first PHP program in the server, and print Hello World.


In this PHP Tutorial, we learned how to write a PHP program, and run it using XAMPP, with the help of an example.