Php
Your First PHP Application: Hello World
6/9/2025
N/A min read

Your First PHP Application: Hello World
Introduction
The best way to start learning PHP is by writing the classic "Hello World" application. In this article, we'll guide you through creating your first PHP app step by step.
Required Tools
To run your first PHP application, you'll need:
- A text editor (VS Code, Sublime Text, etc.)
- A PHP server (XAMPP, WAMP, or running PHP via command line)
Step 1: Install PHP
To install PHP on your computer:
- Download PHP fromphp.net.
- Alternatively, install a development environment likeXAMPPto run Apache and PHP together.
Step 2: Write the "Hello World" Code
Save the following PHP code in a file with a `.php` extension (e.g., `hello.php`).
Step 3: Run the PHP File
If you're using XAMPP:
- Start the Apache server.
- Copy `hello.php` to the `htdocs` folder.
- Visit
http://localhost/hello.php
in your browser.
If you're using the command line:
php -S localhost:8000
Then openhttp://localhost:8000/hello.php
in your browser.
Conclusion
If everything is set up correctly, you should see "Hello World!" displayed in your browser. Congratulations — you've just created and run your first PHP application!