Jump to content

Using PHP's built in Webserver with ProcessWire


hettiger
 Share

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 9
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...