Results 1 to 2 of 2
i have a cgi script , in that i am opening a file to read some data.
when i am placing the file under cgi-bin folder. i am able to ...
- 07-25-2011 #1Just Joined!
- Join Date
- Jun 2011
- Location
- Bangalore, IN
- Posts
- 8
cgi script is not able to open a file which is out side cgi-bin folder
i have a cgi script , in that i am opening a file to read some data.
when i am placing the file under cgi-bin folder. i am able to open the file. but when i a am placing that file in some other dir (/root/conf). script is not able to open that file.
Code:open (FILEHANDLE, "<$test_compatibility_file") || die ("Could not open file!");
- 07-25-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,842
The file you are opening needs to:
a) be in a directory that is 'read/executable' by the user running apache (typically 'nobody')
b) have file permissions that allow the same user 'read' access to that file
This is done for security purposes. You can put the file in a sub-directory under the DocumentRoot (typically /var/www/html). You can also create rules to allow a directory outside the DocumentRoot to be accessible, but do that with caution - and certainly do NOT allow the /root directory to be readable by Aapche!
Check out the apache config file, httpd.conf, and the Apache manual for more details on that.


Reply With Quote