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/.
You can change your document root pretty easily by following these instructions:
httpd.conf
. Mine is located in this directory: /Applications/XAMPP/etc
Find the line that says:
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
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).
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.
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).
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
/etc/extras/httpd-userdir.conf
in your XAMPP Application Folder<Directory "/home/*/public">
with <Directory "/Users/*/Sites">
/etc/http.conf
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
restart apache
Have Fun :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With