amy.damnit wrote:"This file" must be my php file?
I was referring to any file you place outside of the "htdocs" folder.
amy.damnit wrote:The difference is in what your browser can interpret. A understands HTML, but does not understand PHP. So, your PHP server translates the PHP into HTML so the browser can understand it.
Er.. well yeah, I guess that's true. Just to be clear, though, the browser never sees the PHP code - the Apache server calls the PHP interpreter, which loads the PHP file, parses it, and then passes over any output on to Apache which then gets sent to your browser. Most often, yes, you're producing HTML which the browser receives and renders.
amy.damnit wrote:I guess what you were meaning is that HTML cease to have relevance above the Web Root Directory (because apparently that is as high an HTML page can look upwards).
Well, HTML is just a language; it's your browser that has to do the work. When the browser renders the page and sees CSS files to load, it makes separate requests to your webserver to download those files as well. Since the root of your website (e.g. the "/" in "mysite.com/") points to the htdocs folder, it doesn't make sense to pass a path that goes above this directory on to the browser.
amy.damnit wrote:By contrast, the PHP server could - in theory - look anywhere on your server (or network) for a file, because it grabs it, interprets it, and then sends it off to the user.
There isn't a "PHP server" - PHP is just a programming language. If you meant webserver, then yes, the PHP interpreter can access the local filesystem on the server without going through Apache, so "/" to the process executing the PHP code actually means the root of the server's hard drive.
amy.damnit wrote:I meant that is is apparently harder to hack files outside of the Web Root Directory.
That's true; to do so, a hacker would either have to a) have knowledge about a security hole in an application on your site (e.g. content.php?id=news is a script that uses the 'id' to load "news.inc" but without proper precautions could be called as content.php?id=../../secret_dir/mysql_info.php to access files you didn't intend to), or b) compromise the server itself to gain access to the local filesystem (which might happen with some shared hosts).
amy.damnit wrote:Well, they can always see your HTML, but if you created a CSS style sheet dynamically using PHP, could they still see it?
Yes, since CSS is content that you have to pass to the browser in order for it to be useful. Anything you send to the browser, be it HTML, Javascript, CSS, images, etc. can be scraped, copied, whatever you'd like to call it. As far as dynamic CSS goes, it's no different than if you'd make it a static file - it's just CSS data outputted by your websever when a client's browser requests it. In FireFox (with the WebDeveloper toolbar), it's as easy as pressing Ctrl+Shift+C on your keyboard.