0

How can I easily run multiple sites with PHP, Apache and mySQL for free on mac with OSX? I use XAMPP on Windows and it works really well. When I want to add a new site on XAMPP in windows, I only create a new folder in htdocs and visit http://localhost/newfoldername to visit the site.

I know mac OS already have PHP but missing mySQL. However, I thought it was messy when I tested it.

XAMPP - (https://www.apachefriends.org) is not the same on mac and Windows. On mac you need to mount a drive to access the htdocs folder and it was hard to have multiple sites.

MAMP free - (https://www.mamp.info/) can't find how I add multiple sites. I tested to create a new folder "test" with a php-file in htdocs but the webserver could not find the site when I visited http://localhost/test

MAMP PRO - I want to use a free solution (freeware or open source) and you need to pay to use MAMP PRO.

I can live with digging in configuration files once but do not want to do it every time I set up a new PHP site in localhost.

5
  • Running anything native/bare metal on a Mac is fraught with peril. Is run the sites in a VM and use a Turkey Linux image. It’s been a few years since I’ve done it but it was basically plug and play.
    – daneb
    Jan 17 at 5:09
  • That's a rather broad question. You've listed the primary candidates, and the free versions most probably will need some work on your part to configure virtual hosts etc. There are some questions with answers already on AskDifferent about this, maybe you can start with those (and the documentation of XAMPP/MAMP of course) and then ask specific questions about things you are stuck with.
    – nohillside
    Jan 17 at 14:52
  • @nohillside My specific questions is. How can I run multiple PHP sites local on my Mac as easy as I can do with XAMPP on windows? On Mac I can't just create a new folder in htdocs.
    – Xtreme
    Jan 17 at 15:51
  • @Xtreme apachefriends.org/community.html might be the better place to ask this, actually
    – nohillside
    Jan 17 at 17:01
  • And community.apachefriends.org/f/… seems to be a good place to start.
    – nohillside
    Jan 17 at 17:03
1

All of these options have a GUI which is helpful. You could install Apache/MySQL/PHP with Homebrew or MacPorts, but you would be managing all of the settings manually. While this is the best way to get all of the options for free, this increases the difficulty curve.

As another option, I have Abyss Web Server running on my machine to act as a local dev server. The free version allows for 1 site though, there are more features with the paid version.

As with any of these options, you will have to pay for the extra features when using a GUI.

I looked into this years ago when Apple Server abandoned web services. I hope you find something that will work for you.

0

Almost all of the macOS versions have a built-in Apache server. It used to be easier to turn it on, but lately it looks like you have to run /usr/sbin/apachectl start to start it. It seems to be persistent, launching again after reboots, so you should only need to run that once.

Then, add folders inside /Library/Webservers/Documents, or better yet, a symlink to somewhere else where you keep your site(s). I had to tweak httpd.conf a little bit I think, to get Perl CGI to run, it should be simple to get PHP working too, since that's built into macOS too (at least on mine, 11.1).

You can go the full MAMP/XAMPP route if you want, but this is super simple too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .