Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xampp is not finding my home folder --Mac os x

I am trying to use XAMPP with NetBeans for PHP. When I move my files to the htdocs folder everything works fine. However when they are in the home folder XAMPP cannot find them. Below is the instruction from XAMPP I followed it but it's not working.

     **Where should I put my Websites?**
     You can put your Websites in /Applications/XAMPP/htdocs/ 
     and access them via http://localhost/

     Or you put your Websites in the Sites-Folder in your Home 
     and access them via http://localhost/~leslie/.
like image 599
learner Avatar asked Aug 20 '12 20:08

learner


2 Answers

You can change your document root pretty easily by following these instructions:


  1. Locate the file called httpd.conf. Mine is located in this directory: /Applications/XAMPP/etc
  2. Find the line that says:

    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"

  3. Change the path to where you want your files to live. Use an absolute path from the root directory (i.e. it should start with a / and if you're using Unix/Linux and a \ if you're on Windows).

  4. Still in the httpd.conf file, scroll down a few lines until you see this text:

    # This should be changed to whatever you set DocumentRoot to.
     <Directory "/Applications/XAMPP/xamppfiles/htdocs">
    

    and replace the path with whatever you typed in step 3.

  5. This part is important. In order for these changes to take place, you need to restart Apache (otherwise it won't work). Since you're using XAMPP, just use the GUI to do this (click Stop, and then Start next to the Apache label).

Now, you can put your web content in the new directory (i.e. the home folder in your case)



If, on the other hand, you want to add an additional directory to serve files from, locate the httpd.conf file mentioned in step 1 above, and add this line:

Alias /home ~/
<Directory ~/>
Order allow,deny
Allow from all
</Directory> 

Restart Apache Now, you can visit localhost/home in your browser and it will serve files from your home directory in addition to the files in your document root (htdocs by default, or whatever you change it to using the steps above).

like image 103
mynewaccount Avatar answered Oct 26 '22 05:10

mynewaccount


If you're on mac osx 10.9.x and using XAMPP 1.8.3 (or higher)

Apple decided to remove the build-in Apache

  1. open /etc/extras/httpd-userdir.conf in your XAMPP Application Folder
  2. Replace UserDir public_html with UserDir Sites
  3. Replace<Directory "/home/*/public"> with <Directory "/Users/*/Sites">
  4. open /etc/http.conf
  5. search httd-userdir.conf you should find an entry like the following

    #Include etc/extra/httpd-userdir.conf

    replace it with

    Include etc/extra/httpd-userdir.conf

  6. restart apache

Have Fun :)

like image 43
EMDEKEY Avatar answered Oct 26 '22 06:10

EMDEKEY