I have a directory where I store files of sensitive data (db credentials, and such) along with other files where I have altered the permissions, so that PHP can write to the files. Because of the nature of these files I place this directory outside the server's DOCUMENT ROOT
I am trying to figure out how I can dynamically locate the directory above the server's DOCUMENT ROOT. Normally I retrieve the $_SERVER['DOCUMENT_ROOT'] value from PHP, drop off the last directory in the path and I'm there.
The problem I am now having is with sub-domains, which (in the file system realm) is just a directory some where in server's DOCUEMNT ROOT, but the problem is that the DOCUMENT ROOT for a sub-domain is not the server's DOCUMENT ROOT, so the above method does not work.
Through PHP I can access the files in the directory without problems, but I have hard-coded the path in the scripts, and I wanted to find a way to dynamically locate the server's DOCUMENT ROOT.
Thanks.
I am trying to figure out how I can dynamically locate the directory above the server's DOCUMENT ROOT. Normally I retrieve the $_SERVER['DOCUMENT_ROOT'] value from PHP, drop off the last directory in the path and I'm there.
The problem I am now having is with sub-domains, which (in the file system realm) is just a directory some where in server's DOCUEMNT ROOT, but the problem is that the DOCUMENT ROOT for a sub-domain is not the server's DOCUMENT ROOT, so the above method does not work.
Through PHP I can access the files in the directory without problems, but I have hard-coded the path in the scripts, and I wanted to find a way to dynamically locate the server's DOCUMENT ROOT.
Thanks.