Page 1 of 1

Cannot create or edit files in xampp directory

PostPosted: 09. July 2022 10:34
by bonitoh
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?

Re: Cannot create or edit files in xampp directory

PostPosted: 23. October 2022 15:10
by rpuigdel
Hi i have the same problem. did you find a solutions?

Re: Cannot create or edit files in xampp directory

PostPosted: 24. October 2022 16:24
by Nobbie
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.