Cannot create or edit files in xampp directory

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Cannot create or edit files in xampp directory

Postby bonitoh » 09. July 2022 10:34

Xampp was installed in /opt/lampp directory. When I try to create any file in htdocs folder by VS Code or directly in the folder, I have no permission for that. I also cannot change the localhost directory
for another folder out of this directory, cause the file httpd cannot be modified too. So, I cannot use xampp properly to create any local server or something, because I have no permission to modify anything in the directory.

I also tried to modify the directory xampp is installed, but it don't allow you to change the local of installation, the default local is /opt/lampp.

How can I correct this?
bonitoh
 
Posts: 1
Joined: 09. July 2022 10:20
XAMPP version: 8.1.6
Operating System: ubuntu 22

Re: Cannot create or edit files in xampp directory

Postby rpuigdel » 23. October 2022 15:10

Hi i have the same problem. did you find a solutions?
rpuigdel
 
Posts: 1
Joined: 12. October 2022 14:49
XAMPP version: 7
Operating System: linux mint 20

Re: Cannot create or edit files in xampp directory

Postby Nobbie » 24. October 2022 16:24

There are two options how to solve it:

1) Either use "sudo" command to call editor, for example:

Code: Select all
sudo xed test.html


where test.html is your file in DocumentRoot (/opt/lampp/htdocs)

Similar for httpd.conf:

Code: Select all
sudo xed httpd.conf


where httpd.conf is in /opt/lampp/etc

You may use any editor (instead of xed). I personally prefer "vi". The "sudo" command will ask for a password, simply enter your password of your user login.

2) Or change the folder and file permissons of your DocumentRoot and/or the etc-folder:

Code: Select all
sudo chmod 0777 /opt/lampp/htdcocs


as well as

Code: Select all
sudo chmod 0777 /opt/lampp/etc


and also change permissions for httpd.conf:

Code: Select all
sudo chmod 0666 /opt/lampp/etc/httpd.conf


After chmod you can freely edit your files (no need for sudo anymore).

Finally, get and read some Linux books and tutorials, as all of this is basic Linux knowledge and is not a Xampp issue. Its the rights und permissons system of Linux.
Nobbie
 
Posts: 13179
Joined: 09. March 2008 13:04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 29 guests