Installation Guide
CoolBrew is relatively easy to install. For those of you who are familiar with this sort of thing, the QuickStart Guide below is a good place to begin. For those who need more detail, the rest of the guide provides that.
QuickStart Guide
- Download and unzip the CoolBrew package.
- Upload the CoolBrew system folder to your server. Ideally, it should be uploaded to a location outside of any of your websites' document root folders. If you have to upload it into a document root folder, you can do that as long as you set up the system/coolbrew.inc.php file correctly. [more details]
- Open the system/coolbrew.inc.php file with a text editor and enter your configuration information. [more details]
- If you intend to use a database, open the system/config/database.php file with a text editor and set your database settings. this is a system-wide config file and it can be overridden by module-level and document-level config files as needed. For more information about configuring this file, see the Database Configuration section of the CodeIgniter User Guide.
- Edit the include_path directive in your php.ini file to include the system folder [more details], or use an .htaccess file in each of your websites to add the directory to the path. [more details]
- Connect your web pages to CoolBrew by including the coolbrew.inc.php file at the top of the page. For more information, see the Getting Started section of this guide.
- For information about installing modules, see the user guide for each module.
Placing the System Folder in a Document Root
If you put the system folder in one of your document root folders, you will need to tell CoolBrew where to find it. Open the system/coolbrew.inc.php file and change the $system_dir variable:
$system_dir = $server_doc_dir . "/doc-root/system";
Where doc-root is the document root folder in which you placed the system folder.
Editing the CoolBrew Include File
The CoolBrew include file is the system/coolbrew.inc.php file. This is the file that you include at the top of each of your website files to connect your website to the CoolBrew system.
The $sites Array
The trickiest part about setting up this file is setting the $sites array. You must set up an entry in this array for each of the domains that you will be using to access your websites:
$sites = array (
'yourdomain1.com' => array(
'siteid', // the site ID
'root-dir', // the document root dir name
'server-level', // the server level dev|stage|live
'locale' // the default locale
),
);
In this sample, yourdomain1.com is the domain name. Notice that the "www" is not part of the domain name. If your website will accept URLs without the "www" (e.g. http://domain.com as well as http://www.domain.com), leaving the "www" off your definition here will ensure that both URL forms will be recognized.
The siteid is a string of characters that you will use to identify the website in database records and a few other places. It's a good idea to choose an ID that is easy to remember. For example, the ID that I use for the CoolBrew website is 'cb'.
The root-dir is the document root directory for the site the domain points to.
The server-level indicates what kind of site it is. The recommended choices are dev for a development site, stage for a staging site, and live for a live site. These codes are arbitrary, however, and you can use whatever makes sense for your setup. This code will be assigned to the SERVER_LEVEL constant which you can use to set up, for example, different database connection information based on what kind of site it is.
The locale setting will automatically set the 'language' config variable for each of your sites in the system/config/config.php file. In CodeIgniter, this is in the form of the language name such as 'english'. In CoolBrew, I recommend using a combination of a language code and a country code known as a locale. For example, in the United States, the default locale will usually be 'en_US'. You can use whatever you like as long as it matches the folder names you use inside your language folders.
The $server_doc_dir Variable
This variable is the full path to all your document root directories. CoolBrew assumes you have all your websites' document root folders in a single folder. If this is not the case, you will need to specify the full path to each folder in the $sites array and set the $server_doc_dir variable to an empty string:
$sites = array (
'yourdomain1.com' => array('siteid', '/full/path/to/root-dir', 'server-level', 'locale'),
);
$server_doc_dir = '';
You can have document root folders anywhere on your file system, even on different servers if the volumes for that server are mounted on the one running CoolBrew. They must be available through the same file system, though; they cannot be accessed through TCP for example.
Editing the include_path Directive with PHP.INI
CoolBrew is activated in each of your web pages by including the coolbrew.inc.php file at the start of the page. Once that file is included, your page has access to any of the tags supplied by CoolBrew.
To make sure PHP can find the coolbrew.inc.php file, we add the system path to the PHP configuration file, php.ini. To do this, you must have access to your servers php.ini file. Find the file and open it in a text editor. Look for the include_path directive which will look something like this:
include_path = ".:/php/includes:/usr/local/lib/php"
There are slightly different path directives for Unix-like servers and Windows servers, so make sure you use the correct one. In my example, I'm using the Unix path. Just add the path to your system folder:
include_path = ".:/php/includes:/usr/local/lib/php:/path/to/your/system"
Save the file and restart your web server to make it take effect. This is the only time you will need to mess with this unless you change the location of this folder.
Editing the include_path Directive with .htaccess
If you don't have access to your php.ini file, you can use an .htaccess file to make the required change to the include_path directive. Create an .htaccess file with this line:
php_value include_path ".:/usr/local/lib/php:/path/to/your/system"
Be sure to change the path to the appropriate settings for your system.