News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Taking Advantage of PHP's Built-in Server
March 08, 2012 @ 08:17:45

On PHPMaster.com today there's a new tutorial for those on the bleeding edge of PHP using the latest released version (5.4) and a feature that comes with it - using the built-in webserver that comes bundled for testing purposes.

One of the cooler features of the new PHP 5.4 release is a built-in web server designed specifically for development and testing. Now you can write and test your code without having to have a full-fledged LAMP configuration - just launch a the built-in server from the command line, test your code, and then shut it down when you're finished. [...] In this article I'll explain some basic uses of the new built-in server and show you how to build a portable personal development server useful for quickly testing your applications

He starts with a look at how to start up the web server (a simple command line switch and host/port definition) and the resulting default phpinfo page it displays. Other options include the ability to specify a document root for your server and create a sort of "front controller" for it to route requests. They show how to create a simple application based on this that can dynamically load in the index file, a router and pass the request off to the correct file. Their example includes some "niceties" too like logging, "hosts allowed" and checks for requesting directories.

You can find their full code for this example over on github.

0 comments voice your opinion now!
builtin server recent router feature test custom tutorial


blog comments powered by Disqus

Similar Posts

Vinu Thomas' Blog: Create a Storage engine for MySQL using PHP

Sebastian Bergmann's Blog: Getting Started with Hamcrest

FliquidStudios.com: Introduction to using Google's search API

ONLamp.com: Developing Web Services Using PHP

PHPClasses.org: How to Install LAMP with Samba File Sharing


Community Events

Don't see your event here?
Let us know!


introduction opinion release version voicesoftheelephpant threedevsandamaybe community framework extension series api interview podcast security symfony library unittest language laravel laravel5

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework