Installing and Running PHP
Install PHP
On Linux and macOS, use your package manager. On Windows, install from windows.php.net or use XAMPP/Laragon for a local stack. Confirm the CLI works.
php --version
Run a script
Save a file ending in .php and pass it to the CLI.
php hello.php
Start the built-in server
For browser work, PHP can serve the current folder during learning.
php -S localhost:8000
Install tips
- Enable common extensions (pdo_sqlite, mbstring) as you need them
- Web hosts often run PHP for you; local CLI helps learning
- Check
php -mfor loaded modules - Keep a text editor and a browser ready
Comments
One comment per signed-in account. Comments are saved with this page’s URL.