To run PHP locally you need a web server with PHP. The easiest option on Windows is XAMPP (Apache + MySQL + PHP).
Download and install XAMPP from apachefriends.org.
Open the XAMPP Control Panel and start Apache (and MySQL if you need a database).
Save your file in C:\xampp\htdocs\, e.g. C:\xampp\htdocs\hello.php.
Open http://localhost/hello.php in your browser.
You can also run PHP from the terminal: php hello.php, or start a built-in server with php -S localhost:8000.
💡 Key Takeaways: PHP Install
Mastering PHP Install helps you write clean and reliable PHP code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
PHP Install Code Example
PHP
<?php
echo "PHP version: " . phpversion();
Output
PHP version: 8.2.12
Run this example on your own computer. The "Get Started" lesson shows how to set it up.
PHP Install Practice Exercises
Check what you learned in “PHP Install”.
/ 2 solved
Fill in the blank
Start PHP's built-in development server on port 8000.