2

I recently installed Lampp server (version 1.7.7) so I went to my local folder, which I believe is in /opt/lampp/htdocs because that's where I've installed my server, and wanted to create a folder where I can put my projects, but I couldn't because the option in the right-click menu isn't even available.

How can I create a directory here?

2
  • Why don't you put your projects folder in your home directory?
    – Aaron
    Apr 9, 2012 at 19:35
  • That would be awsome if I know how to !
    – Alfa9Dev
    Apr 10, 2012 at 14:59

4 Answers 4

8

First off, I'd do what others have suggested and point your browser at your home folder for the project, but to answer your question....

It's not available because your user doesn't have write access to it, you could...

  • give your self access

    sudo chown $USER:webuser /opt/lampp/htdocs/
    sudo chmod 755 /opt/lampp/htdocs/
    
  • create the directory from the command line

    sudo mkdir /opt/lampp/htdocs/your_project
    sudo chown $USER:webuser /opt/lampp/htdocs/your_project
    sudo chmod 755 /opt/lampp/htdocs/your_project
    

Note on the chown one, check the webuser, probably www-data, but I've seen it as apache

4
  • Yes that worked, now I can change/edit/remove/update anything in that perticular forlder, meaning htdocs, but as soon as I browsed to a php file that is supposed to say "Hello world", I got these errors isntead : Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0; Fatal error: Unknown: Failed opening required '/opt/lampp/htdocs/Alfa9Dev/test.php' (include_path='.:/opt/lampp/lib/php') in Unknown on line 0 Help ?????
    – Alfa9Dev
    Apr 10, 2012 at 9:36
  • Try the same previous commands with -R sudo chmod -R ... or make sure you got the right web group
    – geermc4
    Apr 10, 2012 at 17:35
  • what does webuser signify in this - "sudo chown $USER:webuser /opt/lampp/htdocs/". I thought that was just a randomly chosen username for demonstration purpose so I replaced it with my computers username. Now, this did allow me to create my own folder but now all the other folders in htdocs have a padlock icon on their thumbnail icon. And these files cannot be modified.
    – Ghos3t
    Nov 11, 2018 at 18:21
  • it was a placeholder for whatever the user your web server runs as, look in your web server's config for that, or if you remember what it was then just change it back
    – geermc4
    Nov 12, 2018 at 23:37
0

Change your DocumentRoot and place it in, for example, /home/your-name/my_websites folder

2
  • sudo gedit /etc/apache2/sites-available/default ... change DocumentRoot /var/www into /home/your_name/www
    – Fero
    May 4, 2012 at 22:59
  • 1
    I recommend editing your answer itself to include that information. Also, please note that you should run gksu gedit or gksudo gedit rather than sudo gedit (this explains why). Sep 1, 2012 at 16:56
-1

The safest way to use you projects would be simply to store your files elsewhere and Just keep links to these files in your projects folder.

1
  • I recommend to edit this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on AskUbuntu.) May 19, 2017 at 20:57
-1

Just follow these two steps to resolve it.

  1. goto your lampp folder using Terminal :
    cd /opt/lampp

  2. Run this command : sudo chmod 777 -R htdocs

Now you can easily access lampp folder and can do whatever you want.

1
  • 1
    Please don't recommend 0777 a.k.a. “please-hack-my-system-and-destroy-my-data” permissions for no apparent reason! There's almost never a reason to do that because it can be avoided with more sensible modifications like changing (group) ownership. −1 May 19, 2017 at 20:53

Not the answer you're looking for? Browse other questions tagged .