XAMPP for Mac – My Frustrations & Solutions

These last few days I’ve been trying to get XAMPP to work on my MacBook Pro these last couple of days and it has been frustrating! It seemed I kept running into more and more problems. For those who don’t know, XAMPP is tool for developers to run a LAMP stack (Linux, Apache, MySQL, PHP) on your machine locally. I’ve been running it on my Windows machines for years, and I have been running my production servers on Linux.

Installing just XAMPP and getting it to run with the Control Panel was easy. All my headaches started when I tried to get my vhosts installed and working. The problem I ran into getting XAMPP to run on my MacBook Pro were the following:

  1. XAMPP for Mac is different from XAMPP for Windows
  2. Max OS X comes with a Version of Apache Installed
  3. Mac OS X has additional permissions that are different from Linux

XAMPP for Mac != XAMPP for Windows

My first mistake was that I assumed that XAMPP for Mac is the same as XAMPP for Windows. After digging into it, the file structure and config files are pretty different. The php.ini file is different, and all the binary files are in /xampp/xamppfiles/bin/. On windows the binary files are in their own folders. It took me awhile to figure out where everything was at. This led me into my next problem:

Mac OS X comes with a Version of Apache Installed

When I was trying to debug why stuff wasn’t working, I opened up the terminal and started running commands. There is just one problem, OS X already has a version of Apache installed. So when I cd’d into the bin directory, I would execute this command:

apachectrl -t -D DUMP_VHOSTS

There was just one problem, it was executing the apachectl that was installed by Mac OS X, not the one for XAMPP. So it all my debugging with the config files, etc. wasn’t working. I was going insane. Finally I figured out what was going on and I had to execute this command instead:

./apachectl -t -D DUMP_VHOSTS

It started behaving like I expected! This lead my to my third hang up.

Mac OS X has additional permissions that are different from Linux

This threw me for a loop to. I don’t understand exactly why this was happening, but I kept gettinga  Permission Denied when trying to view the vhost I was trying to setup. The way I used to do it on Windows is I have a partition for all of my development files. I would have a folder at the root of that drive called SVN_Repositories that holds all the SVN Repositories I use for work. So on my MacBook Pro at / I did the same, I had my SVN_Repositories folder. So my vhost would point to a directory like with a name something like this: “/SVN_Repositories/ExampleRepo/trunk/httpdocs/”

So my linux side clicked in and thought “Hrm, it looks like there is something wrong with the permissions. Let me change the folder permissions to 777 just to test.” So I did that and it still didn’t work. This it made me think it still was a vhost configuration issue. So I spent hours testing all sorts of stuff and just getting more frustrating. Then I read somewhere that XAMPP can have problems with OS X’s unique permissions on addition to the FreeBSD stuff it does. It said to host the vhost content in either the Applications folder or Users folder. So I moved my SVN_Repositories folder to my Users folder so it was like this: “/Users/username/SVN_Repositories/ExampleRepo/trunk/httpdocs/”

It finally worked! So the lessons I learned were:

  • Put your vhost content in the Users folder.
  • If you try things from the terminal, make sure you do ./apachectl so you execute the correct binary file.
  • Most of your config files are in the /Applications/xampp/etc/ folder.

As always, hopefully this helps someone. Feel free to leave any questions or comments.

19 thoughts on “XAMPP for Mac – My Frustrations & Solutions

  1. I had read about MAMP, but the stubborn part of my kept trying XAMPP. It was because at first I assumed XAMPP for Mac was an identical port of the Windows version. I thought I would be able to use XAMPP easier.

    I think I will give MAMP a try. I’m just a little hesitant, worried somehow XAMPP will fubar MAMP or vice versa. But I think give it a spin now to see if I like it better. 🙂

    Like

  2. You should also try the just released beta of Zend Server CE. It has a nice Mac OS X download and if you get your feedback in soon (on their forums), you might even make it a better product when it’s released… It’s available here: http://www.zend.com/en/products/server/downloads-all

    Like

  3. I’m still on the fence and researching whether to install xampp or mamp on my mbp, so thanks for sharing your hard-earned knowledge with us newbies. It’s appreciated.

    Like

  4. If you are setting up for development or personal web sharing, why not just load the separate programs? It is so easy now days and you can develop as well as serve up your web pages without the hassle of switching between programs. Unless you are disconnected from the web, you don’t need mamp, xampp, lamp, or wamp. On a Mac, just load mysql and go. Updating php is a breeze also.

    Like

  5. Thanks, your post helped a lot. It turns out that the permissions’ situation is a bit more flexible (any directory, as long as the permissions from root to your directory are open enough will do). Here’s my question (and answer :): http://superuser.com/questions/120816/xampp-access-forbidden/120882#120882

    Like

  6. I want to make my first blog, do you think that drupal cms is good ?

    Like

  7. Thanks for writing this article. Now everything is clear for me.

    Like

  8. Just an update, I highly recommend using MAMP on a Mac instead of XAMPP. It is a whole lot easier. I’ve been using it for several months now without a problem.

    Like

  9. i use the console, in the XAMPP folder
    sudo chmod 777 htdocs
    and the htdocs folder is writable

    Like

  10. Unfortunately, I am going the other way. MAMP’s latest update has complicated installation and and running of the app.

    this may be a problem if you have a previous version of MAMP like I did. MYSQL server will not start and many other problems with the error log, just after downloading and running the 1.9.5 version.

    I really liked MAMP up until this problem. I hate complicated software.

    Like

  11. For me all was solved after I changed the USER and GROUP setting in the httpd.conf. Default is was set to NOBODY:NOBODY. How this helps other OSX users!

    Like

  12. Hello there, this is off-topic and I dont know where else to go to ask this question. Ive Googled for hours and I cant find the right answer for my question.

    I have a MBP and its running Win 7 on bootcamp. I have installed XAMP in both in Win 7 and OSX, I need Win 7 to test my application in IE, apart from the needs to play some cool games which I dont want to admit.

    Ok, here is my problem:

    PHP error message display just fine in Win 7. Eg:
    $ABC = $_GET[abc];

    Will definitely throw an error of undefined variable bla bla..(sorry I dont remember the exact word or message used there), but the page will be generated successfully.

    The same thing wont happen in my OSX. The page just generated successfully without any error message at all.

    I have the display_errors value in the php.ini. Restart my laptop several times and still the error message doesn’t appear. Hope you can shed some light and help me solved this not-so-critical issue.

    Like

  13. I’ve managed to fix it.

    After comparing the php.ini file from my Win 7 and my OSX.. I’ve changed the error_reporting value from

    error_reporting = E_ALL & ~E_NOTICE to error_reporting = E_ALL | E_STRICT

    Hope this might help somebody.

    Like

  14. Phoe, that s a good point about the bookcase Oh and yes, our apt is up high but it is on a busy road. We ve decided to put our bedroom on the side facing over the courtyard instead of the road.

    Like

  15. I had the same problem as Zaki so I used his proposal and worked for me!! Thank you Zaki, now I can see php errors in my OSX!

    Like

  16. well you do have some good Javascript skills that pick up the values in the browser of client e mail. Or else its just Mozilla.
    Any way – I seem to be learning backwards, i have learned static and dynamic web development and was using MAMP until Mac 10.6 and i saw that someone who paid for MAMP PRO was not receiving support and that could be due to Apple wanting dollars for their developers tool box for app builds in the Mac OS environment, thus could be creating head aches for the people at MAMP. i do not know for sure.
    I tried XAMPP on a Mac and am in the process of learning the Linux OS environment just to have a sane and solid web server environment.
    Question: what is a good course to follow to learn virtual environments and Apache.
    I would like to set up a soho network to test web apps on different OS environments and i am assuming going into Linux would or could yield sanity.
    Thanks

    Like

  17. Numerous thank you ! Hello there Writer! I discovered your net web site employing Yahoo so when a Search engine optimizer

    Like

Leave a Reply to Thomas Hunter Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close