Here's the deal - I have suggested to you the 'xampp' approved permissions (what it was designed for). You now have the situation where there's more than one owner for the files in htdocs (a very bad idea in my opinion). I'm pretty sure it (your script) will work correctly with those original ownership and permission values.
You need to do what you want to do. You seem to think, based on your experience/research, that you need to associate your login user with Apache for some reason. That's OK with me, its your machine/setup. BUT I can't help you with that - AFAIK, I'm here to help people get XAMPP working as it comes from the box basically. If someone else wants, to fine. I have been 'doing' Apache for many years, and I have never set up a single system that way. Its always been either a global user 'Apache' + an Apache group, or when using a remote only headless server whomever the FTP login user is + a special group for Apache users. The developers of XAMPP/LAMPP have designed a bash script that is not a true stack, and 'lampp' therefore makes many assumptions along the way (including whom the owner of the files in /htdocs is).
If you want to set up Apache in some other fashion, I suggest you build a proper stack via an installer (yum, apt-get, etc). Those installations are much more amenable to manipulation, as all the components know what you are doing and why and will have the Apache defaults set -- and often will prevent you from creating problems for yourself.
Finally I will give you a hint about what your problem might be - see who the owner of the Apache processes are when you execute - the worker processes need to own the files. (kind of as I explained)
Good Luck with your project.