Current structure:
htdocs
mums
demo.php
login.php
mums
classes
mums.class.php
includes
global.inc.php
config.inc.php
I want to keep mysql database info and the location of the folder containing the mums folder (the internal one) in config.inc.php. Example:
// CONFIG
$mumsConfig['dbName'] = 'mums';
$mumsConfig['dbUser'] = 'root';
$mumsConfig['dbPass'] = 'pass';
$mumsConfig['dbHost'] = 'localhost';
$mumsConfig['folder'] = 'mums';
// END CONFIG
I’d like to include the config file in any class.php file that needs it and also in the global.inc.php file for every page that needs it. The problem is I’m storing the location of the library ($mumsConfig[‘folder’]) in the config file, so I can’t include the config.inc.php file until I know that, which is in the file itself…..
I’m really at a loss on how to set up a very simple config file. FYI this is all staying on LAN so no need to worry about security.
Since both include files are in the same directory i.e under includes. You can just do
require('config.inc.php')in global.inc.php