Skip to content

Instantly share code, notes, and snippets.

@Synchro
Created November 21, 2011 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Synchro/1382334 to your computer and use it in GitHub Desktop.
Save Synchro/1382334 to your computer and use it in GitHub Desktop.
FatFree config for files outside web root
<?php
/*
Folder structure:
/lib (fatfree files in here)
/temp
/ui (view templates)
/web (Doc root, static files and index.php)
If you're not using a .htaccess file, I found the default rewrites don't work in a vhost, had to change it to this:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-l
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^ /index.php [L,QSA]
There's also a bug in base.php when setting the document root:
https://sourceforge.net/tracker/?func=detail&aid=3440742&group_id=288268&atid=1220992
*/
require __DIR__ . '/../lib/base.php';
require __DIR__.'/../config.php';
F3::set('TEMP', __DIR__.'/../temp/');
F3::set('UI', __DIR__.'/../ui/');
F3::set('CACHE', false);
F3::set('DEBUG', 1);
F3::set('APP_NAME', 'xyz');
F3::route('GET /',
function() {
F3::set('modules',
array(
'apc'=>
'Cache engine',
'gd'=>
'Graphics plugin',
'hash'=>
'Framework core',
'imap'=>
'Authentication',
'json'=>
'Various plugins',
'ldap'=>
'Authentication',
'memcache'=>
'Cache engine',
'mongo'=>
'M2 MongoDB mapper',
'pcre'=>
'Framework core',
'pdo_mssql'=>
'SQL handler, Axon ORM, Authentication',
'pdo_mysql'=>
'SQL handler, Axon ORM, Authentication',
'pdo_pgsql'=>
'SQL handler, Axon ORM, Authentication',
'pdo_sqlite'=>
'SQL handler, Axon ORM, Authentication',
'session'=>
'Framework core',
'sockets'=>
'Network plugin',
'xcache'=>
'Cache engine'
)
);
echo Template::serve('welcome.htm');
}
);
F3::run();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment