Eureka Edit(1):
Ok, thanks again @blueweimer , for clarifying that you are using XAMPP on MacOS (and not XAMPP-vm); because thanks to that clarification I was able to find the right answer to your question, which can be found here.
To elaborate on the answer found in the link:
By default, when creating any sort of folder or file in XAMPP in MacOS it uses the user and group found in the httpd.conf file (the d stands for "daemon", which is the name given to running processes in Unix systems (like Linux and Mac, Mac being a slant more differentiated from Unix but still carrying over some of the same terms)). So by changing the user and group found in this file you can change the user that keeps the server running. It's the user that Apache uses to access everything and anything inside XAMPP.
It's important to note that you are changing your access user when changing the file in httpd.conf; but that does not automagically change the owner of the files and folders that have already been created. According to the link above, these files are found in /Applications/XAMPP/xamppfiles/
, you'd have to change the owner of the files and the folder itself to the new user you've changed it to in httpd.conf.
Do not change this user to your own, as any failure in security that can occur on XAMPP will allow anyone with access to your XAMPP server to access your user remotely.
Before Edit:
Firstly, if possible, please post a code snippet so that we may know how this is being accessed.
Secondly, I'd like to apologize for placing all of this in an answer(low reputation so I can't comment just yet), but judging by the mkdir manual page for php, it seems that it creates the directory with the user who's running it as the owner. Given that it's setting the owner to "daemon" and you are unable to access it, I believe it safe to assume that you are not establishing default permissions (0777) and are running the file as a daemon.
You could choose to change the permissions the folders are created with:
<?php
mkdir("/path/to/my/dir", 0777);
?>
Alternatively you could use the chown command to change the ownership from "daemon" to another user within the same php file you create the folders with:
<?php
mkdir("/path/to/my/dir", 0700);
chown("/path/to/my/dir", "username");
?>
This answer was given according to the information provided: you did not specify which webserver you're using (you've simply specified html), and you've not specified an OS, so my understanding ist that it is a Linux distribution (otherwise folder access would not be a problem with PHP but rather with the webserver's permissions).