Linux distributions like Linux Mint, Ubuntu, Kali Linux, and others frequently have this issue. When you attempt to run code within the /opt file and other dedicated folders, or when you copy and move files, the error message appears.
When you attempt to copy or move a file, the error message “failed to open stream: Permission denied in /opt/lampp/..” or “File permission denied on /opt/lampp…” appears. This error persists until the file permission value is changed.
I’ll walk you through the process of setting permissions in this post so that xampp files can do operations like write, remove, and overwrite.
Because only root users are able to run any command in Linux, other users cannot write to directories.
Since the root user owns the htdocs on xampp within the /opt file, all commands from other users may be rejected. For this reason, I will demonstrate how to resolve it.
The procedures to resolve the error “failed to open stream: Permission denied in /opt/lampp/htdocs..” are as follows:
1. To access the root module, open a terminal with root access or use the default terminal and type the following commands: sudo su
2. Use the command sudo chmod -R 777 /opt/lampp/htdocs/ to change the permissions for the htdocs folder and all files within it to 777.
3. Completed.