MAMP Local server and Apache

Is anyone here familiar with the MAMP app? “MAMP installs a local server environment in a matter of seconds on your macOS computer.”

I would like to have a local server environment to let me learn the Joomla CMS, which is another whole thing…

I’ve downloaded the version of the app which says it runs on Apple Silicon, but it fails to start on my Mac Mini M2 OS 14.5 with an error saying it was unable to start Apache. So far MAMP support has been very slow to support this free, not paid, version.

TIA

I use MAMP (the free, non-pro version) on my M2 Studio, Sonoma 14.5. I use it mainly to edit html and php pages for my Web site. Not a sophisticated user, but it works fine for my purposes.

Edit: I don’t use MAMP to edit, of course. I use BBEdit for that. MAMP allows my .php pages to render properly when checking my work in a browser.

Did you have to do anything special to get it to install and run Apache? (I have an M2 Mini with 14.5 so that sounds very similar to you.) I’ve seen various posts around the web providing terminal commands to let the OS start Apache so MAMP can start, but I’m not versed in the use of terminal and none of those solutions has worked for me.

I’ve used MAMP going back to my 2008 Mac Pro with Snow Leopard, and followed that with a series of Intel Macs before the M2 Studio. I don’t recall ever doing anything interesting to get things running. In settings, on the General tab, I’ve got Start servers, Check for updates, and Stop servers checked, with the PHP cache set to OPcache. On the Ports tab I have the Apache port set to 8888. On the Server tab I’ve set the document root as appropriate for my setup. All pretty much SOP. When I launch MAMP it takes a couple of seconds for the server to start, and then all’s good.

I don’t know about MAMP, but Apple still bundles Apache with macOS. It’s pretty easy to edit its configuration files and turn it on.

Here’s a quick summary of what I did on my Mac (currently running macOS 14.5 (Sonoma)):

  1. Edit the Apache configuration file, /etc/apache2/httpd.conf

    I un-commented the following lines:

    • LoadModule userdir_module libexec/apache2/mod_userdir.so
    • Include /private/etc/apache2/extra/httpd-userdir.conf
    • Include /private/etc/apache2/extra/httpd-manual.conf

    These changes do the following:

    • Enable per-user home directories (URLs of the form http://localhost/~username)
    • Include per-user home directory configuration (see below)
    • Enable the Apache manual (at URL http://localhost/manual/), so you have it available
  2. Edit the per-user directory configuration file, /etc/apache2/extra/httpd-userdir.conf and uncomment the following line:

    • Include /private/etc/apache2/users/*.conf
  3. Add a configuration file for each user you want to have a home directory. For instance, for a user named myuser, create a file named /etc/apache2/users/myuser.conf containing:

    <Directory "/Users/myuser/Sites/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
    

    This configuration tells Apache to look in a directory called Sites in the myuser home directory (the location Apple used when they had a GUI interface for personal web serving). It configures the directory for:

    • Enable the following options (features):
      • Indexes. A directory without an index.html page will present a default page showing the files in that directory.
      • MultiViews. Defines a search mechanism that will be followed if you provide a URL pointing at a directory that doesn’t exist, but if other files do exist with that directory’s name. See Content Negotiation - Apache HTTP Server Version 2.4
      • FollowSymLinks. A URL pointing to a symbolic link in the directory will get the content of what the link points to
    • AllowOverride All. If a directory contains an .htaccess file, accept whatever it contains
    • Require all granted. Allow all users to access the directory (no authentication)
    • Order allow,deny. When processing access control directives, first process all Allow directives - of which at least one must match. Then process all Deny directives - if any match, the request will fail.
    • Allow from all. Don’t impose any host-based access controls
  4. Start the web server. Type the following command:

    sudo apachectl start
    

    This command is persistent. The server will auto-start when macOS restarts.

If simple per-user home directories isn’t enough, you can enable/configure any other features by editing various Apache configuration files. See the Apache manual or do some web searches for help with that.

See also: