Skip to content

Config File

RedDragonWebDesign edited this page Sep 5, 2020 · 1 revision

There may be times you don't want to use the installer, and you'd like to generate your own config file. Here is the code and some tips.

Name: _config.php (don't forget the underscore)

Location: root directory

Code

<?php

$dbhost = ""; // Examples: localhost, mysql.yourdomain.com
$dbuser = "";
$dbpass = "";
$dbname = "";

$dbprefix = ""; // Strongly recommend leaving this blank. Exception: You only have access to 1 SQL database, and you need to put tables for multiple engines in the same database. For example: WordPress and BlueThrust. Then give each engine a unique prefix.

$MAIN_ROOT = "/BlueThrust5/";
$BASE_DIRECTORY = "/home/cPanelName/public_html/BlueThrust5/";

$ADMIN_KEY = ""; // Admin pin number. Used as a 2nd password for certain dangerous actions.

define("ADMIN_KEY", $ADMIN_KEY);

What to put for MAIN_ROOT and BASE_DIRECTORY

This can be tricky to get right if you are not using the installer.

Always use forward slashes, even on Windows.

In general, both the beginning and end should have a slash. Exception: C:/ D:/

Example: DreamHost

$MAIN_ROOT = "/BlueThrust5/";
$BASE_DIRECTORY = "/home/dreamhostAccountName/domainName.com/BlueThrust5/";

Example: cPanel

$MAIN_ROOT = "/BlueThrust5/";
$BASE_DIRECTORY = "/home/cPanelName/public_html/BlueThrust5/";

Example: XAMPP for Windows

BASE_DIRECTORY needs to be the directory path, with forward slashes not back slashes, of where you have your Apache DocumentRoot set to, then add on the main root.

$MAIN_ROOT = "/BlueThrust5/src/";
$BASE_DIRECTORY = "D:/Dropbox/Code/BlueThrust5/src/";

If you can't figure it out...

Try running this PHP script. Name it test.php and place it in the root directory of the BlueThrust 5 scripts. View it and copy what it tells you.

<?php

$url = $_SERVER['REQUEST_URI'];
$setMainRoot = str_replace("test.php", "", $url);
$setDocumentRoot = str_replace("test.php", "", $_SERVER['SCRIPT_FILENAME']);

echo "\$MAIN_ROOT = \"".$setMainRoot."\";<br />";
echo "\$BASE_DIRECTORY = \"".$setDocumentRoot."\";";
Clone this wiki locally