"get_cfg_var will not return configuration information set when the PHP was compiled, or read from an Apache configuration file." (from php.net)

If you are running a virtual-host you often have to put your php-confiugration in a vhost.conf (or similar). This configuration-file is read by the apache. So php.ini will not have this configuration-value - and therefore get_cfg_var will not return the expected value in this environment.