PHP Whoami www data table

PHP: get_current_user () vs. exec ('whoami')

Short version of the question:

What's the difference between and?

Long version of the question:

  1. I'm on a XAMPP Localhost on a Mac.
  2. I'm using Apache, building a PHP based website in a folder (let's call it folderxyz) within the htdocs folder (var / www in some flavors of Linux + Apache).
  3. I was playing around with a database connection, testing out PDO :: ERRMODE_EXCEPTION described here: Link

And I got this error:

file_put_contents (PDOErrors.txt): failed to open stream: Permission denied ...

So I did some sleuthing around and it seems that to fix this I need to change the settings of the file PDOErrors.txt to 777.

However, my questions are about something else. During this process I realized that I don't clearly understand the concept of in Apache, PHP, and MySQL.

  • The PHP manual says that "Gets the name of the owner of the current PHP script"link
  • The PHP manual says that returns "the username that owns the running php / httpd process"link
  • When I use, I get my, which is my account name on my Mac.
  • When I use, I get.

So...

  1. What's the relationship between and?
  2. What's the relationship between the "the owner of the current PHP script" other "username that owns the running php / httpd process" ?
  3. Who needs permission to write to PDOErrors.txt? Is it or?
  4. Who needs permission to write to PDOErrors.txt? Is it Apache or PHP (or both)?
  5. Does the concept of a unix-like account factor-in anywhere here?

Edit: I updated this to reflect that it wasn't the folderxyz that I had to change CHMOD settings for. I had to change the settings for the file PDOErrors.txt


OP here: for future reference, I put up a parallel question for the Linux platform here (with an accompanying intuitive explanation of what's going on): https://stackoverflow.com/questions/31389892/why-is-the-output- www-data-in-one-case-and-root-in-another