I assume that maybe your user has rights over /opt/lampp
and because of that you can edit the files. However, if that's not the case you can grant access to both, your user and the apache group. The next shows firs the user, then the group:
sudo chown -R youruser:www-data /opt/lampp
In that way you're setting the ownership to the user and then the group. After that you must grant the access for the three groups: User, group and others:
sudo chmod -R xxx /opt/lampp
Note: The rightmost refer to permissions for the file owner, then the group and other users.
Now, what does the xxx mean?
No - Permission - rwx
7 - full - 111
6 - read and write - 110
5 - read and execute - 101
4 - read only - 100
3 - write and execute - 011
2 - write only - 010
1 - execute only - 001
0 - none - 000
Or you can use:
chmod [reference][operator][mode] fileOrFolder
Where the reference is: u(ser), g(roup), o(thers) and a(ll).
The operator is: + (adds the specified modes to the specified references), - (removes) and = (the modes specified must be made the exact modes for the specified references)
Finally the modes are: r(ead), w(rite), x(execute), [X(special execute), s and t (that are not so common)].
Hope this is what you're looking for.