require doesn't work in a module's file I have this module's inc file, which hold page callback functions. Also I have a 'config.php' file that hold the parameters. I know this is not a good practice, but I would like to leave these config there for now.
Here is the question, I cannot get access to the parameters in the config.php file after I used require 'config.php' or require_once 'config.php'.
e.g. I have admin.inc which holds these:
&lt;?php
    require 'config.php';
    
    function my_page_callback(){
        global $config;

        var_dump($config); //this prints NULL when I access this menu item.
    }

    

and config.php holds these an located in the same folder:
&lt;?php

    $config = array();
    $config['key'] = 'value';
    $config['name'] = 'foobar';

The file is successfully included since there is no fatal error, but why can't I get these values?
update
var_dump($config); this would print the right content after I move the require statement to the body of my_page_callback, but I don't think this is how PHP works.
Explicitly set $config as global in the required file could give non-NULL result, but it is not needed in my test files.
You can use this approach to include a file in .module

function module_name_init(){
    module_load_include('inc', 'module_name', 'includes/common');
}


and place common.inc file in includes folder in your custom module.Now write your php code here.