Hello, on your fresh install of XAMPP in Ubuntu and other linux distros, you will face a common problem - you cannot do anything inside htdocs folder. The problem is that since the htdocs folder is present in /opt/ directory it requires password to modify files in the htdocs folder.
1. The easier wayJust enter the following commands in the terminal and you're good to go.
sudo chmod -R 777 /opt/lampp/htdocs
The above command will enable all users in the network to access your htdocs folder. If you don't want this to happen, implement method 2.
2. The harder way
This method will eliminate the problem in the above mentioned method. Do the following.
- Find your username by entering the command who am i
and you will see the result as shown below.
who am i command to know your username
- Next enter the command in the terminal in the format as follows:
sudo chown -R username:username /opt/lampp/htdocsReplace username with your username and the above code will ask for your password.
chown command to change ownership of htdocs folder
- Add the user to the Apache configuration file by the following command
sudo gedit /opt/lampp/etc/httpd.conf
- Find for the following lines
User nobody Group nogroup
|editing httpd.conf file to add your username|