www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TOKI...@aol.com
Subject general/6786: opening file for read during initialization phase
Date Thu, 02 Nov 2000 08:32:20 GMT

> i am writing a module to be added to the Apache server; I need to open some
> files for reading some infomation; the init phase of the module is repeated 
> the first time the file is correctly opened, the second one it is reported 
> the file does not exists: why, and how can be solved this problem?

Make sure you use the full pathname of the file and don't
assume that Apache is always in the same directory
when the module init takes place... no matter how many
times it fires.

Apache might have done a chdir() between init calls.

If your file is relative to the ServerRoot dir used for Apache
then you can just use the global string 'ap_server_root' at that point
and build the full pathname...

#ifdef WIN32
char dirsep[]='\\'; /* Windows uses a backslash */
char dirsep[]='/"; /* Unix uses a forward slash */

sprintf( filename, "%s%smyfile.ext", ap_server_root, dirsep );

View raw message