Documentation:Installation

From TinyMVC Documentation

Jump to: navigation, search

Contents

Installing TinyMVC

Quick "I just want to see it" Install

  • unpack the archive in your web doc root
  • point your browser to the htdocs/index.php file

You should see the welcome screen.

Single Installation (Typical)

This basically means a single website. If you are installing multiple websites and want the TinyMVC core codebase to be shared between them, then skip down to the Shared installation.

Unpack the distribution archive in a temporary place. You will see the following structure:

/htdocs/
  index.php

/tinymvc/
  /myapp/
  /myfiles/
  /sysfiles/
  • Place the index.php file inside your web server document root.

The index.php file is the file directly accessed by the web browser. No other files are required inside the doc root.

  • Place the /tinymvc/ directory (and contents) outside your web server document root.

The /tinymvc/ directory holds all of the system files and application files. It is recommended (but not required) to place this directory somewhere outside of your web server document root.

If you decide to place this in your doc root, be sure to restrict browser access to /tinymvc/ with your web server configuration.

Example install:

/var/www.foo.com/htdocs/
  index.php

/var/www.foo.com/tinymvc/
  /myapp/
  /myfiles/
  /sysfiles/
  • Edit the index.php file and set configuration options.

Inside the index.php file, you will find the following:

/* PHP error reporting level */
//error_reporting(E_ALL);
 
/* if your /tinymvc/ dir is not up one directory, uncomment and set here */
//define('TMVC_BASEDIR','../tinymvc/');

If necessary, uncomment and set the php reporting level. For development, you might want to enable all error reporting with E_ALL.

If necessary, uncomment and set the TMVC_BASEDIR path, which is the path to where you installed the /tinymvc/ directory. If this is located one directory up from the index.php file, the default setting should work.

Be sure to include a trailing slash.

Once you are finished, take your browser to http://localhost/index.php (or wherever the index.php file is on your web server). You should see a welcome screen. If not, check the error messages, and check your data paths and configuration settings again.

Database Settings

If you are using a database, be sure you edit your database settings here:

/tinymvc/
  /myapp/
    /configs/
      config_database.php

database.php:

$config['default']['plugin'] = 'TinyMVC_PDO'; // plugin for db access
$config['default']['type'] = 'mysql';      // connection type
$config['default']['host'] = 'localhost';  // db hostname
$config['default']['name'] = 'dbname';     // db name
$config['default']['user'] = 'dbuser';     // db username
$config['default']['pass'] = 'dbpass';     // db password
$config['default']['persistent'] = false;  // db connection persistence?

You can have multiple database connection settings. "default" is the name of the default connection. To make new settings, copy all seven lines and make a new setting name.

Leave the plugin setting as TinyMVC_PDO, unless you are using your own custom database library. Set the type, host, name, user, pass and persistent settings according to your database server.

Shared Installation

Each website has it's own index.php file and /myapp/ directory associated with it. The websites can share the main TinyMVC code base. This way TinyMVC upgrades are done in one place.

The /sysfiles/ directory is what you update when you upgrade TinyMVC, it should never be touched. The /myfiles/ directory is where you can place custom plugins that you want shared across websites.

For each website, you will install a separate index.php file and /myapp/ directory.

  • Install the /tinymvc/ directory in a central location.
  • Copy the index.php file under the doc root.
  • Copy the /myapp/ directory out of the /tinymvc/ directory to a place that coincides with the index.php file.
  • Edit index.php set the TMVC_BASEDIR and TMVC_MYAPPDIR path.

Example setup for three different websites:

# shared code
/usr/local/lib/tinymvc/
  /myfiles/
  /sysfiles/

#website 1
/var/www.foo1.com/htdocs/index.php
/var/www.foo1.com/myapp/

#website 2
/var/www.foo2.com/htdocs/index.php
/var/www.foo2.com/myapp/

#website 3
/var/www.foo3.com/htdocs/index.php
/var/www.foo3.com/myapp/


For each website, edit the index.php file and set the path to TMVC_BASEDIR and TMVC_MYAPPDIR. Example:

index.php:

/* TinyMVC base library path */
define('TMVC_BASEDIR','/usr/local/lib/tinymvc/');
 
/* application library path */
define('TMVC_MYAPPDIR','../myapp/');

Be sure to include a trailing slash.

Personal tools