Ensuring the correct permissions for executing and writing to folders is crucial for the smooth operation of XAMPP when creating a development server on your PC.

This issue is often encountered on Linux distributions such as Linux Mint, Ubuntu, Kali Linux, and others. The error occurs when attempting to execute code within the /opt directory or other designated folders, as well as when copying or moving files.

The error message typically reads ‘Failed to open stream: Permission denied in /opt/lampp/..’ or ‘File permission denied on /opt/lampp/..’ when attempting file operations. This issue persists until the file permissions are appropriately modified.

In this guide, I will outline the steps to set permissions that will allow XAMPP files to execute actions such as delete, write, and overwrite.

In Linux systems, only root users have permission to execute commands, making folders not writable for others by default.

Since the htdocs directory in XAMPP is owned by the root user within the /opt directory, commands from other users can be denied. Here’s how to rectify this:

  1. Open a terminal with root access or run the default terminal and enter the root module with the following command: sudo su
  2. Change the permissions for the htdocs folder and all files within it to 777 by running the following command: sudo chmod -R 777 /opt/lampp/htdocs/
  3. That’s it. The necessary permissions have been set, resolving the ‘Failed To Open Stream: Permission Denied’ error in /opt/lampp/htdocs/.

Leave a Reply

Your email address will not be published. Required fields are marked *