1. php-hello-world

My First PHP Program

In this guide, we'll walk through creating and running your first PHP program.

We'll start a PHP development server and create a basic "Hello, World!" PHP script.


Make sure you have PHP installed on your machine. If not, you can download it from

Step 1: Create a PHP File

Open a text editor and create a new file. Save it with a .php extension. For example, index.php.

echo "Hello, World!";

Step 2: Start the PHP Development Server

Open a terminal or command prompt and navigate to the directory containing your PHP file. Run the following command:

php -S localhost:8000

This starts a PHP development server on localhost at port 8000.

Step 3: Open the Browser

Open your web browser and navigate to http://localhost:8000/index.php. Replace index.php with the actual name of your PHP file.

Step 4: View the Output

You should see the "Hello, World!" message displayed in your browser.

Stop the Server:

When you're done, go back to the terminal or command prompt and press Ctrl + C to stop the PHP development server.


Congratulations! You've successfully created and run your first PHP program. This simple "Hello, World!" script is a fundamental building block for more complex PHP applications.

Feel free to explore and experiment as you continue your PHP journey.

Published on: