3. Installation

3.1. Before installing

Here are the requirements for setting up a server to run Trex:

  • PHP version 5 or newer.
  • An HTTP server with the following enabled: mod_rewrite.
  • A database engine. Supported databases are MySQL, MySQLi, MS SQL, Postgre, Oracle, SQLite and ODBC.

Framework

3.2. Installation Instructions

3.2.1. Download

Before you can get started, you need to download the latest version of Trex. You can do this manually by visiting http://trex.phpimpact.com/download with a browser and choosing the tar.gz or zip download, or you can use the command line:

$ wget http://trex.phpimpact.com/files/tgz
$ tar -xvzf TrexFramework-<version>.tar.gz

3.2.2. Configure

Open the config/DatabaseConfig.php file with a text editor and set your database settings (view example). If you want access to the debug log, open the config/DebugConfig.php and add your IP address to the allowed list (view example).

3.2.3. Upload

Upload all files and folders to your web server and place them in the root folder of your web site (eg: /public_html). Normally the index.php file will be at your root.

3.2.4. Set the permissions

Set full access to the cache/ and logs/ directories:

$ cd ~/public_html
$ chmod 777 cache
$ chmod 777 logs

3.2.5. Create the rewrite rules

The rewrite rules are contained in the default .htaccess file that ships with Trex, so you shouldn’t need to set them explicitly.

We recommend using .htaccess files for testing and debugging, and when you have a configuration you like, move the directives into a <Directory> container in the httpd.conf file and delete the .htaccess file.

httpd.conf file

RewriteEngine on
RewriteRule ^/images/(.*)  /public/frontend/images/$1 [L]
RewriteRule ^/css/(.*)  /public/frontend/css/$1 [L]
RewriteRule ^/js/(.*)  /public/frontend/js/$1 [L]
RewriteRule !.(js|ico|gif|jpg|png|css|swf|pdf|doc|zip)$ /index.php

Admin Site (optional)

3.3. Installation Instructions

3.3.1. Configure

The Admin site is not enabled by default, it’s an opt-in thing. To enable the Admin site for your project, open the config/SiteConfig.php file and set the “admin_enabled” option to true.

3.3.2. Run the install script

Once all the files have been successfully uploaded to your web server, you will now need to run the installation script that will guide you with the setting up of your database. To start the installation process, open your browser and type the HTTP address of your site followed by /install, eg: http://www.domain.com/install.

If everything was done correctly, you should be able to see your site in a browser without any errors. Site control panel is available at http://www.domain.com/admin/ The default login is “admin” and password is “admin”.