Advantages/disadvantages of using the built-in Apache for web development on Mac OS X
What are the advantages and disadvantages of using the built-in Apache for local web development on Mac OS X, specifically 10.6 Snow Leopard?
Instead of using the built-in Apache, I know that options such as MAMP and XAMPP exist. However, for some reason I just haven't wrapped开发者_开发问答 my head around the benefits or potential pitfalls with using the built-in Apache versus using a MAMP/XAMPP-based (or other) solution.
- Is the advantage of a MAMP/XAMPP-based solution simply ease of configuration?
- When not using the built-in Apache are there other benefits besides ease of configuration? For instance, is there a benefit similar to using virtualenv to avoid tainting a pristine Python install?
- If you're only developing static webpages and don't need PHP or MySQL, then why not use the built-in Apache with something like virtualhost-sh or VirtualHostX to ease configuration?
Configuration and Usage Considerations
- I am interested in using virtual hosts in order to simultaneously develop multiple websites
- I use git for version control and have a tendency to store source files in
~/development
instead of~/Sites
(this probably isn't material, but thought I'd mention it)
Related Research
- The answers to the SuperUser Question What is the best Apache PHP Setup for a Mac Developer talk about different MAMP, XAMPP, and roll your own solutions
Advantages:
- It's already there, you don't have to install anything
- If all you are interpreting are .html files only, then it's fine.
Disadvantages:
- You can't update it (Well you shouldn't. You can, it just feels hacky modifying stock system components).
- If you wanted to enable PHP/MySQL etc later on you will be changing things in paths on the system that may break between OS updates.
- If this is your primary OS, you are now running extra daemons (PHP/MySQL/Apache) in the background that eat up CPU cycles.
Overall though I wouldn't do it. MAMP's daemons are easy to start/stop and your changes are confined to MAMP. If you mess something up or need to quickly get different sites running with different settings it's kinda easier to blast things away in MAMP and start again (not that MAMP is without it's hassles).
If you don't want to use MAMP i'd suggest getting a dedicated Linux box (or use a Linux Virtual Machine) to do this on having been down the OSX Apache path before. It's not pretty. OSX's built in stuff might seem easier at first, but it's inflexible and eventually as your requirements grow you'll wish you hadn't done it.
Update: I would recommend going with XAMPP over MAMP. It has better performance and is updated more often. Plus XAMPP is Cross platform and Open Source :)
I've used the stock Apache 1.x in previous versions of OS X for both local development and production web sites and have never had a problem with system updates breaking anything. I've never done anything extremely fancy, but have had plenty of vhosts, regular and reverse proxies, PHP, Python and Perl CGIs, custom cgi-bin locations, custom logs, etc, without issues. It has always worked exactly as I expect Apache to work.
This has continued to be the case with Apache 2 under 10.6. So for local development and low-key production stuff, I'd trust it.
I've had the same experience with the stock Apache installs on OS X Server, with the exception that using the provided GUI tools to edit the httpd.conf files has always been a total disaster. They simply never worked for me, overwrote previous changes, or outright crashed.
精彩评论