1

I am developing apache module . I want to read some data from my own config file . How to read the config file in Apache . I am using C language to develop the module.

2 Answers2

0

You should avoid it, because Apache provides you with a sophisticated configuration mechanism. If you insist on doing it, register a post_config hook and do C programming 101 I/O to read a file and parse it.

covener
  • 17,402
  • 2
  • 31
  • 45
0

You need to include ap_config.h in your c code.

ap_config_file *fl;
apr_pool_t *pl;
location = "location of your file";
apr_pool_create(&pl,NULL);
if(ap_pcfg_openfile(&fl,pl,location)==APR_SUCCESS){
/* do your stuff here */
}