Burying and Digging Up PHP Bones

So, I finally found some corroborating discussions–on StackExchange, StackOverflow, and SitePoint–about where to put PHP files with sensitive information (username, pw, database name). The answer is, I thought (but wasn’t sure and didn’t understand why the answer was correct even if it was), in a directory on the same “level” as your public directory. And, thinking about it now, I understand why files in the public directory can access it while the “public” can’t: Permissions (see what a prodigy I am?).

The only irritating part of the three discussions was that one person referred to the public_html folder as “public” and the next directory up (what would be /home/jscript in the first screenshot below) as “root” while the next poster stated the “public” and “root” directory were the same.

So, I created a “PHP” folder I’ll play with later:

Screenshot of my FileManager for my hosted site including a new PHP folder in the root directory.

I have a new list of questions but none are work-stopping or frustrating:

  • Why are there two folders, public_html and www–aren’t they the same?
  • How “related” is that etc folder to the etc folders in Ubuntu? It’s a Linux server so I get that much but what is their specific purpose? And why are there always multiple etc folders? And multiple bin folders for that matter?
  • Why do some folders (access-logs and www) appear in the right but not the left?
  • What’s the difference … oh, nevermind … I was going to ask … between logs and access-logs but I’m pretty sure logs is everything that goes on in my site but access-logs is just shizzle from the outside world.

I can’t wait to learn what mysteries lie within the public_html/cgi-bin folder.

Of course, I wanted to compare my localhost structure:

Screenshot of local host directory on my laptop

I definitely want to see how my localhost acts differently than my hosted site with equivalent file structures so I’ll play with that, too. As long as bones I bury in the host server can’t be dug up (with little or no effort at least), I’ll be happy.

Questions/thoughts based on localhost:

  • On my iMac’s web server, “Home” is the “root folder” as far as the command line and stuff are concerned and “Home” is my user folder. On my Ubuntu laptop, my “Home” folder is the “Home” folder (in the second screenshot above) aka my user folder BUT all the web server shizzle is under “Devices > Computer” (same screenshot) and that was a pain to (not know and to) figure out when I was using the command line. And yet … gosh, I wish I could remember how the paths were so similar … I’ll update this post later with that information.
  • What are these “ports” I’ve always heard about? And why does adding them to the URL access things that aren’t in my html folder? Hmm … those ports are what I use with Elasticsearch and Kibana (to the extent that I “use” them) and they’re in the etc folder (sibling to the var folder in the path above) … and that’s also where PHP, Python, Apache, MySQL, PHPmyAdmin and other shizzle live.

Is all of this stuff I’d learn in a basic Computer Science course?


About jotascript

Aiming to please. Seeking to impress.
This entry was posted in PHP, Web Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s