GyanMilega

How to Set Up a PHP Server on Windows Without Installing XAMPP (Step-by-Step Guide)

Author: Sagar Kudu
Sagar Kudu

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

  1. Visit the official PHP for Windows website.

  2. Choose the Thread Safe version (e.g., php-8.x.x-Win32-vs16-x64.zip).

    php

  3. Download the ZIP file.

  4. Extract it to a folder like C:\php.

    phpAfter Extraction, it should look like this:
    php

  5. 👉 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:

  1. Open Start Menu → search for “Environment Variables” → click Edit the system environment variables.

  2. In the System Properties window, click Environment Variables.

  3. Under System variables, find and select the Path variable → click Edit.

  4. Click New and add: C:\php (Make sure to create a php folder in C: drive)

    php

  5. 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.

php


📁 Step 3: Create Your PHP Project Folder

  1. Create a folder for your PHP project, e.g., C:\demo

  2. Inside that folder, create a file called index.php with 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!

  1. Open Command Prompt.

  2. Navigate to your project folder:

cd C:\demo
  1. Start the PHP server:

php -S localhost:8000

Output:

php

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

Output:

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.exe in C:\php

  • Allow 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):

  1. Download Composer from getcomposer.org.

  2. Run the installer and point it to your php.exe path.

  3. 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.


Powered by wisp

Related Posts

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 Story

MongoDB 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 Story

What 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 Story

Unlocking 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
Loading...
© Gyan Milega 2025