How to Set Up a PHP Server on Windows Without Installing XAMPP (Step-by-Step Guide)
Are you a developer or student looking to run PHP scripts on your Windows machine without installing XAMPP? You're not alone. XAMPP is popular, but it's also bulky and includes services you might not need. In this guide, you'll learn how to set up a PHP server on Windows manually — lightweight, fast, and without the bloat.
🚀 Why Skip XAMPP?
XAMPP bundles Apache, MySQL, PHP, and more into a convenient package. But here’s why you might want to avoid it:
Unnecessary services if you're only testing PHP.
Slower performance due to bundled components.
Lack of flexibility for fine-tuned configurations.
Learning limitations — you don’t learn how things actually work under the hood.
Now let’s build a PHP development environment the manual way!
🛠 Prerequisites
Before starting, make sure you have:
A Windows 10 or 11 PC
Administrator privileges
Internet access to download PHP
📥 Step 1: Download PHP for Windows
Visit the official PHP for Windows website.
Choose the Thread Safe version (e.g.,
php-8.x.x-Win32-vs16-x64.zip).
Download the ZIP file.
Extract it to a folder like
C:\php.
After Extraction, it should look like this:
👉 Tip: Avoid folders with spaces in the name to prevent path issues.
⚙️ Step 2: Add PHP to the Windows PATH
To run PHP from the command line anywhere:
Open Start Menu → search for “Environment Variables” → click Edit the system environment variables.
In the System Properties window, click Environment Variables.
Under System variables, find and select the
Pathvariable → click Edit.Click New and add:
C:\php(Make sure to create aphpfolder in C: drive)
Click OK to close all windows.
✅ Now, open Command Prompt and type:
php -v
If PHP is installed correctly, you’ll see the PHP version information.

📁 Step 3: Create Your PHP Project Folder
Create a folder for your PHP project, e.g.,
C:\demoInside that folder, create a file called
index.phpwith the following content:
<?php
echo "Hello, Sagar!";
?>
🌐 Step 4: Start PHP’s Built-In Development Server
PHP comes with a built-in server (since PHP 5.4+), no Apache or Nginx needed!
Open Command Prompt.
Navigate to your project folder:
cd C:\demo
Start the PHP server:
php -S localhost:8000
Output:

✅ Visit http://localhost:8000 In your browser, you should see "Hello, PHP Server!"
Output:

🔒 Bonus: Run PHP as Administrator or Set Firewall Rules
If Windows Firewall blocks the port (8000), allow PHP through:
Search "Allow an app through Windows Firewall"
Click Change settings
Click Allow another app, browse to
php.exeinC:\phpAllow it for Private networks
📦 Optional: Use Composer with PHP
If you're working on real-world PHP projects, you’ll likely need Composer (PHP's package manager):
Download Composer from getcomposer.org.
Run the installer and point it to your
php.exepath.After installation, check:
composer --version
🧠 Final Thoughts
You’ve just learned how to:
✅ Install PHP manually on Windows
✅ Run a local PHP server without Apache or XAMPP
✅ Serve PHP scripts using the built-in PHP server
This approach is lightweight, fast, and beginner-friendly. It gives you more control over your dev environment — great for learning or microservice development.
Introduction to Node.js (Full Interview Guide)
Explore Node.js with our concise infographic detailing its core functionalities. Learn how this JavaScript runtime powers fast, scalable backend development, real-time apps, and robust APIs. Perfect for developers and businesses looking to understand Node.js benefits.
Read Full StoryMongoDB Crash Course | Complete Guide
A complete MongoDB guide covering installation, CRUD operations, queries, updates, deletions, and advanced features with clear examples and step-by-step instructions.
Read Full StoryWhat is JavaScript? A Complete Beginner's Guide
Learn what JavaScript is, how it works, and how to add it to your web pages with inline, external, async, and defer script loading strategies.
Read Full StoryUnlocking the Future of AI with On-Demand GPUs at Low Costs
Unlock the power of AI without the high costs of traditional hardware. On-demand GPUs offer affordable, scalable, and maintenance-free access to premium computing resources, billed by the minute. Perfect for startups, researchers, and developers, you only pay for what you use, saving both money and time. Get access to cutting-edge GPUs like H200 and B200 for AI training, fine-tuning, and inference—starting at just \$1.89 per hour. Embrace flexibility and efficiency with on-demand GPU services.
Read Full Story