PHP 5.4 New Built-in Web Server

Valic —  April 7, 2012 — Leave a comment

One of the more fascinating facilities provided in PHP 5.4 is a built-in web server.

It runs from the command line on Windows, Mac or Linux. You require to enter to the folder where your application resides then run:

php -S localhost:8080

This command will start a console-based web server. The document root is located in the  folder:

PHP 5.4.0 Development Server started at Sat Apr 07 10:36:35 2012
Listening on localhost:8080
Document root is /home/user/phpapp
Press Ctrl-C to quit

Now you can then open http://localhost:8080/ in your browser.  The server will return either index.php or index.html in the root folder.

This PHP 5.4 web server is intended for development purposes and I think it will be adopted by text editors and possibly browser plug-ins as an easy way to test PHP code.



Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.