Using MAMP

MAMP setup

Running your project with MAMP

 

MAMP - basic usage

  • Click ‘Start’ button to start Apache, PHP, MySQL
  • Click the ‘Preferences’ cog button to:
    • Set port number for Apache and MySQL
      e.g. Apache Port: 80, MySQL Port: 3306
    • Set the root folder of the project 
      e.g. Users/UserName/Sites/Project/public_html
  • If the desired PHP version is not listed in the php drop down of MAMP:
    • Rename other php folders in Applications/MAMP/bin/php — MAMP only shows 2 of the latest php versions
      e.g. rename ‘php8.0.0’ too ‘php8.0.0_RENAME_TO_ENABLE’
  • Log files:
    • All log files are stored in: /Applications/MAMP/logs/
    • The logs need to be enabled on Apache, in the file: /Applications/MAMP/conf/apache/httpd.conf
      #CustomLog /Applications/MAMP/logs/apache_access_log combined
      — remove '#' to uncomment this line:
      CustomLog /Applications/MAMP/logs/apache_access_log combined
    • Apache will write the access logs into /Applications/MAMP/Library/logs/access_log.
  • Restart MAMP Apache server: press 'Stop' button, then 'Start' button.

 

Config files

 

Add a new project:

  • Add a new item to hosts list in: /etc/hosts
  • Add a new block in the config file:
    • Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
    • Make sure all the paths are correct
  • Restart MAMP

 

Useful information:

  • If you want to maintain multiple domains/hostnames on your machine you can setup VirtualHost containers for them.
  • Most configurations use only name-based virtual hosts so the server doesn't need to worry about IP addresses.
  • You may use the command line option '-S' to verify your virtual host configuration.

 

Example of the httpd-vhosts.conf file:

 

# Virtual Hosts
# Required modules: mod_log_config
# Use name-based virtual hosting.

NameVirtualHost *:80
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests
# that do not match a ServerName or ServerAlias in any block.

    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/Applications/MAMP/Library/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common
##################################
#   EXAMPLE PROJECT 1
##################################

  AcceptPathInfo on
    DocumentRoot /Users/UserName/Sites/ExampleProject1/public_html
    ServerName dev.example1
    ErrorLog /Users/UserName/Sites/ExampleProject1/logs/error.log
    CustomLog /Users/UserName/Sites/ExampleProject1/logs/access.log common
    DirectoryIndex index.php
    AllowOverride all
    Order allow,deny
    Allow from all
##################################
#   EXAMPLE PROJECT 2
##################################

 AcceptPathInfo on
    DocumentRoot /Users/UserName/Sites/ExampleProject2/public_html
    ServerName dev.example2
    ErrorLog /Users/UserName/Sites/ExampleProject2/logs/error.log
    CustomLog /Users/UserName/Sites/ExampleProject2/logs/access.log common
    DirectoryIndex index.php
    AllowOverride all
    Order allow,deny
    Allow from all
Climbing Turn logo

Clear understandable advice from Climbing Turn

Give us a call on +44 (0)1438 791010

Let's talk

Other blog items

How much do you share?

Privacy at a bus stop

Full post link to blog item in full link to blog item in full: hover colour

Google Analytics

Full post link to blog item in full link to blog item in full: hover colour

Introducing BTR International

International move management services

Full post link to blog item in full link to blog item in full: hover colour

DragonVet: a Hand-crafted Digital Presence

Make your message clear

Full post link to blog item in full link to blog item in full: hover colour

How and Why has Launched

A website made to stand out from the crowd

Full post link to blog item in full link to blog item in full: hover colour

Merlin Engine API builder

Get Ready… It’s Almost Here!

Full post link to blog item in full link to blog item in full: hover colour

How to prevent Phishing

Phishing is associated with a particular type of nasty fraud.

Full post link to blog item in full link to blog item in full: hover colour

General Data Protection Regulation

This new regulation comes into enforcement on the 25th of May 2018.

Full post link to blog item in full link to blog item in full: hover colour

Lasting Impressions for ExpressionEngine

Lasting Impressions is ExpressionEngine 4 ready!

Full post link to blog item in full link to blog item in full: hover colour

Cyber Security

Five tips on how to keep your business safe

Full post link to blog item in full link to blog item in full: hover colour

Is Your Website Rubbish?

How to measure its success online

Full post link to blog item in full link to blog item in full: hover colour

Top tips to woo customers

Things that customers love

Full post link to blog item in full link to blog item in full: hover colour

Top mistakes that lose you customers

Top 5 mistakes to avoid when publishing on the internet.

Full post link to blog item in full link to blog item in full: hover colour

Is your Web Site Ready for Brexit?

Leaving the EU will bring both threats and opportunities

Full post link to blog item in full link to blog item in full: hover colour

Primary School Children Code HTML

Full post link to blog item in full link to blog item in full: hover colour

Curse of the Brochure Site

Missing the opportunity

Full post link to blog item in full link to blog item in full: hover colour

A Web “Page”

It’s NOT a page!

Full post link to blog item in full link to blog item in full: hover colour

Expression Engine MSM and CartThrob

Using the same channel to sell items on different sites

Full post link to blog item in full link to blog item in full: hover colour

Exceptionally Dull Weirdos

This is a response to Willard Foxton's recent article on the Daily Telegraph blog

Full post link to blog item in full link to blog item in full: hover colour

The Website Machine

What is a website?

Full post link to blog item in full link to blog item in full: hover colour