Jan 29, 2026
```
## Chapter 1: Install PHP (Windows / macOS / Linux)
Goal of this chapter: install PHP, confirm it works in the terminal, and avoid “it installed but nothing runs” problems.
### A) Windows (two good options)
#### Option 1: Install only PHP (lightweight)
1. Download the latest PHP zip for Windows from the official PHP site (choose the non-thread-safe build if you will use PHP-FPM later; for learning, either is fine).
2. Extract it to a simple path, for example:
`C:php`
3. Add `C:php` to your PATH:
- Start Menu → search “Environment Variables”
- Edit the PATH variable → New → `C:php`
4. Open PowerShell and verify:
```bash
php -v
php -m
```
If `php -v` works, you’re ready.
#### Option 2: Install XAMPP (easy local web server)
If you want Apache + PHP + MySQL in one installer, XAMPP is the simplest. Install it, start Apache, and put your PHP files in the `htdocs` folder.
When to use which?
- “Only PHP” is perfect if you want CLI + built-in server and a clean setup.
- XAMPP is convenient if you want Apache and MySQL quickly.
### B) macOS (Homebrew)
```bash
brew update
brew install php
php -v
```
### C) Linux (Ubuntu/Debian example)
```bash
sudo apt update
sudo apt install php php-cli php-mbstring php-xml php-curl php-sqlite3
php -v
```
Different distros use different package managers, but the idea is the same: install `php` and a few common extensions.
---
### Setup details: php.ini and extensions (small things that save hours)
Sometimes PHP is installed, but features are missing (JSON, cURL, mbstring, database drivers). That usually means: the extension is not installed or not enabled.
### Find your active php.ini
```bash
php --ini
```
This prints which `php.ini` file PHP is actually using.
### See which extensions are loaded
```bash
php -m
```
If you don’t see something like `curl` or `mbstring`, install/enable it.
On Linux you usually install extra extensions using packages (example):
```bash
sudo apt install php-curl php-mbstring
```
On Windows (zip install), you typically enable extensions in `php.ini` by removing the `;` in front of the line, and making sure `extension_dir` points to the correct folder.
---
## Conclusion
In this article, we explored the core concepts of All about PHP - Install PHP (Windows / macOS / Linux). Understanding these fundamentals is crucial for any developer looking to master this topic.
## Frequently Asked Questions (FAQs)
**Q: What is All about PHP - Install PHP (Windows / macOS / Linux)?**
A: All about PHP - Install PHP (Windows / macOS / Linux) is a fundamental concept in this programming language/topic that allows developers to perform specific tasks efficiently.
**Q: Why is All about PHP - Install PHP (Windows / macOS / Linux) important?**
A: It helps in organizing code, improving performance, and implementing complex logic in a structured way.
**Q: How to get started with All about PHP - Install PHP (Windows / macOS / Linux)?**
A: You can start by practicing the basic syntax and examples provided in this tutorial.
**Q: Are there any prerequisites for All about PHP - Install PHP (Windows / macOS / Linux)?**
A: Basic knowledge of programming logic and syntax is recommended.
**Q: Can All about PHP - Install PHP (Windows / macOS / Linux) be used in real-world projects?**
A: Yes, it is widely used in enterprise-level applications and software development.
**Q: Where can I find more examples of All about PHP - Install PHP (Windows / macOS / Linux)?**
A: You can check our blog section for more advanced tutorials and use cases.
**Q: Is All about PHP - Install PHP (Windows / macOS / Linux) suitable for beginners?**
A: Yes, our guide is designed to be beginner-friendly with clear explanations.
**Q: How does All about PHP - Install PHP (Windows / macOS / Linux) improve code quality?**
A: By providing a standardized way to handle logic, it makes code more readable and maintainable.
**Q: What are common mistakes when using All about PHP - Install PHP (Windows / macOS / Linux)?**
A: Common mistakes include incorrect syntax usage and not following best practices, which we've covered here.
**Q: Does this tutorial cover advanced All about PHP - Install PHP (Windows / macOS / Linux)?**
A: This article covers the essentials; stay tuned for our advanced series on this topic.