Last Updated: February 25, 2016
·
4.096K
· grazerc0de

Local Server without Apache [PHP]

Almost all PHP programmers use Apache or NGINX as their server.
Even they're just coding using PHP (no SQL).
For this reson, Actually you can start your own server with just using the executable php file
in Windows (php.exe).
Thi s very useful if you want to experiment or learn more about PHP without database. You still can use MySQL if the socket was started.

Note : This only works for PHP version 5.4

Steps:

  • Fire up your terminal or command prompt in windows

  • Now cd in your web project. in my case its in J:\Userrs\White\myproject

Picture

  • And type php -S [serverip/domain:port] In this case I type php -S localhost:8089 Picture

You can set any port as long it is not being use.

  • And now fire up your facourite browser

  • Goto localhost:8089 in my case.

  • Notice the index.php in my project folder is loaded in browser

Picture

4 Responses
Add your response

You can still access sql sockets with the build in server.

over 1 year ago ·

yes you're right if the socket started

over 1 year ago ·

you should add a small note; this only works as of PHP 5.4

over 1 year ago ·

oh sorry for that, i've add it

over 1 year ago ·