Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I save my HTML and PHP files when I am using a local server on my Mac (OS X 10.6 Snow Leopard)

Tags:

php

macos

local

I am learning PHP and MySQL and just set up a local server on my Mac Snow Leopard. The different components work (PHP work, MySQL works from the terminal, and Apache is set up.

Where should I save my HTML and PHP files? Some sources say /users/[my username]/sites/. Other sources say /MacHD/Library/WebServer/Documents. Still other sources say that I should save my files into an Apache folder? What's the right answer?

Thanks!

like image 691
Andy Avatar asked Jan 31 '11 02:01

Andy


2 Answers

The main http://localhost/ webroot is at /MacHD/Library/WebServer/Documents

Your Sites folders will be accessible at http://localhost/~username/

If you install a new Apache or other webserver (e.g. via MacPorts, Fink, or some other method.) you'll need to refer to the documentation to discover the webroot, httpdocs & htdocs are common defaults.

Avoid using something like MAMP, if you actually prefer to know exactly what is on your system, if you don't care about the nuts and bolts, an all-in-one like that could be useful, YMMV.

like image 188
ocodo Avatar answered Sep 28 '22 09:09

ocodo


While this isn't exactly the answer you are looking for, I have been using MAMP PRO for a while now and it has greatly simplified my local development experience.

While you might not want to pay for the pro version out of the gate, the regular will definitely get you started and give you most of the basic tools you will need to get server-side development rolling on your mac. Including phpmyadmin, mysql, php, apache and allow you to point the webroot of mamp at any directory you choose, so you can utilize a project directory inside your home directory.

But again, Slomojo 's is definitely a more 'correct' answer.

like image 40
jondavidjohn Avatar answered Sep 28 '22 08:09

jondavidjohn