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

NETTUTS.com: Advanced Regular Expression Tips and Techniques

Brian Swan's Blog: How to Page Data with the SQL Server Drivers for PHP

Stefan Mischook's Blog: Setting up an MVC structure with the Zend Framework - part 1

Sebastian Bergmann's Blog: Visualizing Text Differences in PHPUnit 3

Mike Purcell's Blog: Symfony - sfGuardPlugin - Use Email Instead of Username


Community Events





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


unittest list version voicesoftheelephpant extension install language opinion laravel community interview configure api composer introduction conference podcast symfony release series

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