Jump to content
hettiger

Using PHP's built in Webserver with ProcessWire

Recommended Posts

If you're interested in running ProcessWire using PHP's built in Webserver this one's for you:

<?php

/*****************************************************************************
 * Router script for emulating Apache's "mod_rewrite" functionality.
 * This router script is designed for testing ProcessWire instances quickly.
 * Don't use this script and/or PHP's built in Webserver in production.
 *
 * Usage: php -S localhost:8000 -t /ProcessWire /ProcessWire/routing.php
 *****************************************************************************/

$uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if ($uri !== '/' && file_exists(__DIR__ . $uri)) return false;

$_GET['it'] = $uri; // emulate index.php?it=$1
require_once __DIR__.'/index.php';

Enjoy!  :)

  • Like 8

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...