Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53870 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77847 invoked from network); 11 Jul 2011 14:15:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2011 14:15:36 -0000 Authentication-Results: pb1.pair.com header.from=ralph@smashlabs.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ralph@smashlabs.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain smashlabs.com from 67.15.58.61 cause and error) X-PHP-List-Original-Sender: ralph@smashlabs.com X-Host-Fingerprint: 67.15.58.61 openrce.org Linux 2.6 Received: from [67.15.58.61] ([67.15.58.61:36945] helo=users.smashlabs.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/30-09103-F750B1E4 for ; Mon, 11 Jul 2011 10:15:32 -0400 Received: (qmail 5175 invoked from network); 11 Jul 2011 09:15:00 -0500 Received: from ip174-73-14-247.no.no.cox.net (HELO ralph-macbook.local) (174.73.14.247) by smashlabs.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 11 Jul 2011 09:15:00 -0500 Message-ID: <4E1B0579.8000307@smashlabs.com> Date: Mon, 11 Jul 2011 09:15:21 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Built-in web server routing script and static assets From: ralph@smashlabs.com (Ralph Schindler) Hey Kiall, An optional argument to the built in web server can be a php based router. If the router returns false, it will attempt to return the resource as-it-is on disk. Your command line looks like this: php -S localhost:8000 -t ./path/to/docroot routing.php routing.php can be one of two things- either a drop in replacement for .htaccess or your sites index.php. My routing.php looks like this: Hiya, > > I've been playing with the built-in server, and have some concerns over how > static assets are handled. > > Currently, to run an application on the built-in server, we essentially need > to list out all the static assets that should be served directly from disk. > This is the opposite of what I believe the most common web server > configurations use. > > I believe the built-in server should mimic typical configurations, rather > than requiring applications to write code solely for PHP's web server. > > Have I just missed something? or if not, what do people think of how static > files are handled currently? > > A typical Apache config extract (IMHO): > > # Turn on URL rewriting > RewriteEngine On > RewriteBase / > > # Allow any files or directories that exist to be displayed directly > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > > # Rewrite all other URLs to index.php/URL > RewriteRule .* index.php/$0 [PT] > > Apologies is this has been brought up before, I've not seen any discussion > of this topic so far. > > Thanks, > Kiall >