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.
Asked
Active
Viewed 439 times
2 Answers
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
-
could you give me a example. – sumit chansouliya Aug 10 '16 at 11:30
-
Download Apache's source code and look at any standard module. – covener Aug 10 '16 at 14:46
-
thanks for the suggestion . Now I am able to read config file . – sumit chansouliya Aug 12 '16 at 06:08
-
@sumitchansouliya I am facing similar issue. Could you direct me to right resource? Thanks – Pravy Nov 24 '16 at 02:19
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 */
}

sumit chansouliya
- 81
- 2
- 9