# Apache / PHP built in server

**URL:** <https://www.phphelp.com/t/apache-php-built-in-server/34757>\
**Category:** PHP Installation and Configuration\
**Created:** [May 15, 2022, 12:09am UTC](https://www.phphelp.com/t/apache-php-built-in-server/34757 "2022-05-15T00:09:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PHPNob](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/f0a364/32.png) [@PHPNob](https://www.phphelp.com/u/PHPNob)\
**Post date:** [May 15, 2022, 12:09am UTC](https://www.phphelp.com/t/apache-php-built-in-server/34757/1 "2022-05-15T00:09:16Z")

</div>

using apache vs using php built in server when dealing with **URL params** and routes is a bit confusing.

How do I make each folder inside the htdocs acts like php built in server so each folder would be the document root

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [May 15, 2022, 12:40am UTC](https://www.phphelp.com/t/apache-php-built-in-server/34757/2 "2022-05-15T00:40:58Z")

</div>

You need to create virtual hosts.

---

<div class="post-metadata">

**Author:** ![PHPNob](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/f0a364/32.png) [@PHPNob](https://www.phphelp.com/u/PHPNob)\
**Post date:** [May 15, 2022, 1:26am UTC](https://www.phphelp.com/t/apache-php-built-in-server/34757/3 "2022-05-15T01:26:10Z")

</div>

It does change the document root but it won’t handle url params the same way

so I have in index.php `echo $_SERVER["REQUEST_URI"];`

If I go to _ **localhost:3001/home** _ It would print home using php built in server

but with xampp It would just give 404 if I add any parameter to the url

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [May 15, 2022, 1:52am UTC](https://www.phphelp.com/t/apache-php-built-in-server/34757/4 "2022-05-15T01:52:24Z")

</div>

If you are going to localhost anything, you didnt set up virtual hosts.

I would suggest you use Laragon. It is much better than XAMMP and creates virtual hosts automatically. You would just go to [https://yourapp.test](https://yourapp.test)

> **[Laragon - portable, isolated, fast & powerful universal development...](https://laragon.org/)**
>
> Laragon is a fast & powerful local development environment.

---

<div class="post-metadata">

**Author:** ![PHPNob](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/f0a364/32.png) [@PHPNob](https://www.phphelp.com/u/PHPNob)\
**Post date:** [May 15, 2022, 2:08am UTC](https://www.phphelp.com/t/apache-php-built-in-server/34757/5 "2022-05-15T02:08:35Z")

</div>

> [@benanamen](#):
>
> If you are going to localhost anything, you didnt set up virtual hosts.

yes I changed the hosts in the host file so I am going to landingpage/

gonna check that laragon

---

<div class="post-metadata">

**Author:** ![PHPNob](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/f0a364/32.png) [@PHPNob](https://www.phphelp.com/u/PHPNob)\
**Post date:** [May 15, 2022, 2:34am UTC](https://www.phphelp.com/t/apache-php-built-in-server/34757/6 "2022-05-15T02:34:36Z")

</div>

![image](https://www.phphelp.com/uploads/default/original/2X/6/6cd0b615ae82d64f82e241d9b89264cbb8803379.png)  
 ![image](https://www.phphelp.com/uploads/default/original/2X/c/cf8e68555f8cbf70db5e241c18e32d0cae1c5806.png)

It does not achieve it but I like largon, thank you for telling me about it

Edit: nginx does the job

 ![image](https://www.phphelp.com/uploads/default/original/2X/3/367381fe4708b209e2921cc01b0d538c57c50b01.png)
