How to put my project outside htdocs folder in XAMPP on Mac OSX

Edit
Set XAMPP environment variable on MAC OS X | tech amigos

XAMPP is a really good tools to quickly setup a php dev environment. Yet the default setup of putting all the php code within the "/Applications/XAMPP/xamppfiles/htdocs" in OSX is not so developer friendly, as I have a habit to put all my code under "/username/projects/", I used to just go into the httpd.conf of XAMPP to change the "DocumentRoot" and "< Directory>" tag to my project folder, so I can run the code while maintain my own folder structure.

Today, while I have to work on a PHP project again, I took some time to look into if I can create a symbolic link in "htdocs" folder so that I don't need to mess with "httpd.conf" anymore. After reading many blog. I found a recipe to do it! Below is the reciple

1. install XAMPP

2. don't change the default httpd.conf

3. git clone the project you want to work on in anywhere you like, in my case "/username/projects/myPhpProject"

4. open a terminal and go to  "/Applications/XAMPP/xamppfiles/htdocs"

5. type the command "ln -s /username/projects/myPhpProject ./myPhpProject" , by doing this you are creating a symbolic link of your "myPhpProject" folder in "htdocs"

6. in a terminal type "chmod a+rx /username/projects"

7. restart Apache in XAMPP

NOTE: you might need to do "chmod +x" on every folder in the path "/username/projects/myPhpProject"


Here is the link of where I get part of the recipe from :


P.S. I use XAMPP instead of the build in php server on OSX because, there is a GUI in XAMPP and the tool itself is cross platform meaning, I could use the same recipe while my workstation is Linux or Window :)

How to put my project outside htdocs folder in XAMPP on Mac OSX How to put my project outside htdocs folder in XAMPP on Mac OSX Reviewed by DF on 11:11:00 PM Rating: 5
©DF. Powered by Blogger.