my problem is very straightforward but I can't resolve it.
In my index.php I'am including two PHP files.
require_once("/lib/config.php");
require_once("/lib/connect.php");
In config file I declare variable #config
$config = array(
"db" => array(
"www_db" => array(
"username" => "user1",
"password" => "pass1",
"conn_string" => "blabla"
)
),
"paths" => array("images" => $_SERVER["DOCUMENT_ROOT"] . "/images")
);
In connect.php I have a singleton class Connection.
class Connection
{
private static $instance = NULL;
public static function getInstance()
{
if (!self::$instance)
self::$instance = new Connection();
return self::$instance;
}
private $conn;
// Create connection to Oracle
public function getConnection()
{
//if (INCLUDE_CHECK == true)
// {
$conn = oci_connect($this -> $config["db"]["www_db"]["username"],
$this -> $config["db"]["www_db"]["password"],
$this -> $config["db"]["www_db"]["conn_string"]);
My problem is that my Connection class doesn't see $config variable declared in config.php. I have also tried to declare $config as global. I am getting error " Undefined variable: config..." "... in connect.php". Please help.