Saturday, October 3, 2015

Is there a built-in web server for PHP?

Yes there is one which can be used for testing and designing web applications.

Runs in an environment similar to sandbox environment and does not have all features. If you need a full blown web server you can use Windows Internet Information Services (IIS).

You can start the web server with this command:

C:\Users\mysorian>php -S localhost:8083

PHP 5.4.14 Development Server started at Fri Sep 25 11:01:49 2015
Listening on http://localhost:8083
Document root is C:\Users\mysorian
Press Ctrl-C to quit.

The document you are viewing is in the Document root folder.

But if you try to access the localhost on Port 80 you would get this response.
C:\Users\mysorian>php -S localhost:80

[Fri Sep 25 11:01:12 2015] Failed to listen on localhost:80 (reason: An attempt was made to access a socket in a way forbidden by its access permissions.)

No comments: