Friday, January 14, 2011

Interesting PHP functions : ini_get/get_cfg_var/getenv; memory_get_peak_usage

If not tried before, try using ini_get to get the configuration variables.
Use case:
 You do not want to change your php.ini file for open_basedir restrictions, then just get the configuration value using ini_get and then you can set it using ini_set

To  enable and disable or change the error_reporting values on a given page use:
error_reporting(8183);   at the top
error_reporting(get_cfg_var('error_reporting'));at the bottom [gets orginial value, not the set value].

get_cfg_var returns the value from php.ini directly,while the ini_get returns   the runtime config value


getenvGets the value of an environment variable