Create permission in local XAMPP server in Ubuntu
In Linux, root or the privileged user that you specify during the XAMPP installation, becomes the owner of all the files and folders . Thus, root account owns htdocs and prevents any other user to write or read your application hosted inside htdocs.
How to assign Permission in XAMPP htdocs folder in Ubuntu
Change the ownership of htdocs
If we change the ownership of a file or folder, the new owner will automatically get the write permission. Use $ whomai command to know the logged in username (in this case, username is ap).
$ sudo chown $USER:ap /opt/lampp/htdocs
Use following command ls -lstrd to review your changes to ensure that the new user becomes root of the htdocs folder.
$ ls -lstrd /opt/lampp/htdocs