I have my lampp installed in the default /opt/lampp directory and the PHP code is in the htdocs folder. Now, to edit any of the files I have to use sudo permissions and have to type my password (or use sudo -i) which I do not want to do.

All I want is to know if I can somehow make lampp use the code that is residing in a folder not located under /opt/lampp/. I tried giving full path and using a '..' relative path - both did not seem to work.

Or is it okay to do my work in /opt/lampp/ folder by using sudo all the the time?

  • 1
    Please refer to Permissions issue: how can Apache access files in my Home directory? for reasons why you are having issues with home directory paths for Apache. As I believe this is a duplicate of that question. – Marco Ceppi Jun 26 '11 at 15:07
  • @Marco Ceppi Thanks for adding the lampp tag. I tried to, but, new users are not allowed to create new tags. My search wasn't effective enough to find that question. Anyways, I have to find out about execute bit and then try the mentioned solution. I will do it and update. – Sundeep Jun 26 '11 at 17:52

To actually answer your question although I believe using lampp is not a good thing:

Try to use a symbolic link. Change into your htdocs directory and do something like sudo ln -s /home/<your user name>/Documents/my_website my_website where ~/Documents/my_website is a directory in which you can put all your PHP scripts. Make sure this folder exists. This is now tested and it works for me.

| improve this answer | |
  • Why has this been downvoted? – Nemo Oct 16 '11 at 0:32

lampp is the most stupid thing I know. There are dozens of web servers you can install using the package management, for example apache's httpd. All you have to do is install apache2 Install apache2 and php5 Install php5. Then do sudo a2enmod userdir and sudo /etc/init.d/apache2 reload. Now you can put all your PHP scripts in ~/public_html/ and access it on http://localhost/~<your user name>/

| improve this answer | |
  • But LAMPP (XAMPP) has several package versions. I used to install XAMPP to get php-5.2 since ubuntu has updated to php-5.3 and doesn't provide php-5.2 packages. – Capi Etheriel Jun 26 '11 at 14:32
  • You should ask yourself why you use an almost 5 year old version of PHP which no longer gets any security updates. – dAnjou Jun 26 '11 at 14:50
  • Thanks @dAnjou . Apart from that I have to install MySQL(phpMyAdmin too) and so found LAMPP much easier. I should try out what you have mentioned too. – Sundeep Jun 26 '11 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.