Apache HTTPD – Frequently Asked Questions
Why am I getting errors when I try to upload files?
There are a couple of possible reasons for this. One is that you may have bumped against your site’s file storage quota (see Quotas). The other possibility is that your SFTP client had done something odd with permissions (see this question). If neither of these addresses your problem, please contact Web Services to open a ticket.
What is the Data Directory?
There are times when sensitive information, such as database connection strings, may need to be available for a web site to use, but that you would never want a visitor to see under any circumstances. In such cases, the DATA directory is a safe location that is not addressable by a web browser, but is still available to the web site’s code to use.
How would I make use of it?
Without going into specific coding examples, a high level view of how you might make use of the DATA directory in your PHP (or Perl or Python) code would be:
- Start with the document root of your web site. This should result in a path like:
- /var/www/html/root/www.purdue.edu/itap/webservices
- Replace the “html/root” part of the path with “data/root” (the rest should stay the same). This gives you your “data” root and should result in a path like:
- /var/www/data/root/www.purdue.edu/itap/webservices
- Open and read files relative to this path.
- Use the data read.
- Close the file.
It is not possible to create a URL or reference that would allow you to have a visitor directly access one of these files. That is kind of the point. Instead, if you need to have a visitor be able to see a file in the DATA directory, your code must open the file, read its contents, and send it to the visitor’s browser with appropriate headers that the browser can interpret the data correctly. We hope to have an example of such code online in the future.
Can my application write to my site’s HTML directory?
No. Writing to a site’s HTML directory is a surefire way to get a site compromised or defaced. Please refer to our Writable Files and Directories standard.
Can my application write to my site’s DATA directory?
No. In production, the environment is served by a cluster of servers with no shared storage. If you were to write a file to the DATA directory on one server, the other servers would have no knowledge of the file and accesses would fail. If you must have a location that you can upload files to, please contact Web Services for assistance in mapping a departmental file share into the DATA directory for your site. Because this share is mounted on all servers, files written there will be visible to all servers at a given tier.
How does my DATA directory stay in sync between the servers?
In short, it doesn’t. The multiple production servers each have their own private copy of the DATA directory and do not share storage. The Deploy Tool ensures that files deployed from lower tiers are copied to all of these directories, just as it does with the HTML directories.
I have a question about quotas.
Please see the Quotas FAQ.