Wednesday, July 15, 2015

How to use MySQL 5.6 with MAMP and MAMP PRO

Although MySQL 5.6 has been available since 2011 its market share is still much smaller than that of its older brother MySQL 5.5. That is why MAMP and MAMP PRO still bundle v5.5.

For those of you who absolutely require MySQL 5.6 to be part of their development environment - maybe you are a Magento developer - we have released a shell script that updates the MySQL component of MAMP and MAMP PRO to v5.6. The script requires at least MAMP and MAMP PRO 3.3, older versions are untested.

By the way, if you do not know why you would want to upgrade to MySQL 5.6, don't do it! Reverting the MySQL software back to 5.5.x is easy, just re-install MAMP and MAMP PRO. Future updates of MAMP and MAMP PRO will also revert MySQL back to 5.5.x. But: Data you have entered using MySQL 5.6 will not be transitioned back to 5.5.

Let's get started
Step 1:
Download the script archive and unpack it. You will get a file called Install_MySQL_5.6.25.command.

Step 2:
Start the script by double-clicking it. This will open a shell window in that displays the output of the script.

The script gives some instructions and explanations, please read them carefully. You will also have to enter your Mac OS X admin password to allow for some file system modifications.

The script automatically creates a copy of your databases in /Applications/MAMP/db/mysql and /Library/Application Support/appsolute/MAMP PRO/db/mysql (you need them if you want to go back to MySQL 5.5), downloads MySQL 5.6.25 from our server and installs it into the MAMP folder.

Step 3:
This step is very important, please do not skip it. It varies depending on whether you are a MAMP or a MAMP PRO user.

If you are a MAMP user and have not changed the MySQL configuration file, you may now start the MAMP application, click Start Servers and select Upgrade MySQL databases from the menu Tools. Click Upgrade to convert the databases to the new format of MySQL 5.6.

If you have changed a MySQL configuration file my.cnf, please make sure that its content is compatible with MySQL 5.6. Otherwise MySQL might not be able to start.

If you are a MAMP PRO user and have modified the MySQL template you must also make sure its settings are compatible with the new database server. Type CMD-2 to open the MySQL template in the integrated template editor. You can use the find function (CMD-F) to quickly locate certain options.

For example, the variable table_cache is only compatible with MySQL 5.5 but breaks the newer version. You should either replace it with table_open_cache, deactivate it by putting a # character before its line or completely remove it from the config file.

After you have checked the MySQL template, start the servers and upgrade the databases with the command Upgrade MySQL databases from the menu Tools.

Back to the roots
If MySQL 5.6 fails to start, the first thing you should do is to look at the error entries in the error log. MAMP users find in at /Applications/MAMP/logs/mysql_error_log.err, MAMP PRO users only have to click on the right arrow next to log file area in the MySQL section to open it. The log file might contain helpful hints of what went wrong.

You can spot the aforementioned table_cache option, for example, because of the log entry

[ERROR] /Applications/MAMP/Library/bin/mysqld: unknown variable 'table_cache=64'

The safest way to check if you are really running MySQL 5.6 is to open a Terminal window and type

/Applications/MAMP/Library/bin/mysqld --version

It's easy to go back to MySQL 5.5 should the need arise. Simply re-install MAMP and MAMP PRO. The installer takes care of restoring the databases of MySQL 5.5. As the installer simply restores the databases the shell script created during the installation of MySQL 5.6, all data you have entered using MySQL 5.6 will not be transitioned back to 5.5. Going to MySQL 5.6 is a one-way road data-wise.

Nota bene: The database restoration also will only work if you install MAMP 3.3, older versions only install the MySQL 5.5 binaries.


Wednesday, July 08, 2015

Configuring MAMP PRO components with Custom Templates

While MAMP PRO offers configuration options for the most common settings of Apache, MySQL and PHP, experienced users may want to fine-tune some of the lesser used options. Instead of directly editing config files such as http.conf, php.ini or my.cnf, MAMP PRO uses template files to allow for custom changes to your server environment. You can access your templates through the MAMP PRO menu.

A template file is created in ~/Library/application support/appsolute/MAMP PRO/templates when you make a change to one of your templates.There are separate templates for your Apache, Apache SSL, PHP, and MySQL configurations. If you have not made any changes to your templates, your ~/Library/application support/appsolute/MAMP PRO/templates directory will be empty.


If there has been a change to the configuration of Apache, PHP, or MySQL (A directive was modified or a new one added) between versions of MAMP PRO and you have already made changes to your current configuration (resulting in the creation of a template file in ~/Library/application support/appsolute/MAMP PRO/templates ), MAMP PRO will ask you to save off your old templates when you upgrade. 

A popup dialogue will appear when you upgrade.

Save your template files. You can use these saved template files as a guide of your previous modifications. New (re)modifications need to be made through the MAMP PRO interface (File > Edit Templates), just as you had done before in your previous version of MAMP PRO.


Wednesday, May 06, 2015

MAMP PRO and Postfix

MAMP PRO only uses Postfix from Mac OS X to implement basic mail-sending capabilities. It was designed to help developers to check if their mail scripts are working correctly, to see if all the information that is supposed to be in a mail, is really there, to check the layout and so on. It was never intended to use Postfix as a full-fledged email server replacement. Please keep that in mind.

A minimal Postfix setup is simple. We use Googles Gmail service as an example to demonstrate the workings of Postfix.

In the Postfix section of MAMP PRO please set the domain of outgoing emails to "". Leave the Smart Host checkbox unchecked.

Click the Button "Use this data". In Postfix' log file you will see something like

Dec 12 09:10:48 Tonne postfix/master[31865]: daemon started -- version 2.9.4, configuration /etc/postfix

The log file is located at /var/log/mail.log and can be viewed with

In MAMP PRO, create a host (let's call it postman) and assign it a document root folder.

In a text editor create a PHP script, a basic mail-sending PHP script would look like

Please replace and with working Gmail addresses. Save the script to the document root folder of postman.

Make sure the servers of MAMP PRO are running and click on the right arrow located next to the field "Server name" in the General section of the Hosts view. Your web browser should open and show the message "Testing Postfix...".

In /var/log/mail.log new entries will appear, similar to

Dec 12 09:11:26 Tonne postfix/pickup[31994]: EF76490ECED: uid=502 from= 
Dec 12 09:11:26 Tonne postfix/cleanup[31995]: EF76490ECED: message-id=<20141212081126 .ef76490eced=""""> 
Dec 12 09:11:27 Tonne postfix/qmgr[31997]: EF76490ECED: from=, size=391, nrcpt=1 (queue active) 
Dec 12 09:11:28 Tonne postfix/smtp[31998]: EF76490ECED: to=,[]:25, delay=2.2, delays=1.1/0.02/0.38/0.69, dsn=2.0.0, status=sent (250 2.0.0 OK 1418371832 k5si1095875wjf.30 - gsmtp) 
Dec 12 09:11:28 Tonne postfix/qmgr[31997]: EF76490ECED: removed

The most important information is status=sent. This means Postfix has handed the message over to Gmail which has accepted it. The last line indicates that Postfix has removed the message from its local queue, Postfix has done its work!

If, and where to, Gmail delivers the message is out of the hands of Postfix now. Please check your spam folder if the message does not show up in your inbox. Make sure you are looking in the correct spam folder, on Gmails webpage it's hidden behind "More" in the folder hierarchy on the left side.

If you need more sophisticated email capabilities you might want to use a Smart Host. In this case, please contact your email provider for the correct settings. Typically, free accounts do not have smart host capabilities.


Thursday, February 19, 2015

Editing your httpd.conf file in MAMP PRO

Your MAMP PRO Apache Server httpd.conf file is located in your ~/Library/Application Support/appsolute/MAMP PRO directory. ~/Library is a hidden folder, you will need to unhide it in the Mac Finder or use some other utility to see hidden folders. This file cannot be edited directly. MAMP PRO will overwrite this file every time it starts up the Apache Server. Changes you make to this file will be lost.

The httpd.conf Template File

Modifications to the Apache Server directives need to be done through the MAMP PRO interface, or the httpd.conf template file. You can open the httpd.conf Template file through the MAMP PRO menu.

The httpd.conf Template file text and all other template files are color formatted. MAMP directives are in red, text that will be directly written into the real httpd.conf file are black, while comments are brown. The following is an example of a directive that is commented out by default.

#CustomLog "/Applications/MAMP/logs/apache_access.log" combined

When you uncomment this directive an apache_access.log file will be created in your /Applications/MAMP/logs directory. You can now see how many “hits” each your hosts are receiving.

You could also create an apache_access.log file for each host. Make use a MAMP PRO directive to achieve this. 

The following directive, added to the httpd.conf Template file, will create a unique apache_access file in your /Applications/MAMP/logs directory. This directive is placed inside of the 

MAMP_VirtualHost_iteration_begin_MAMP loop. Add the following line.

CustomLog "/Applications/MAMP/logs/MAMP_VirtualHost_ServerName_MAMP_apache_access.log" combined

Now that this line has been added to your httpd.conf Template file, save your changes and restart your servers. In your Applications/MAMP/logs directory you will now have an hostName_apache_access.log file for each host.

Verifying Your Changes [ MAMP PRO Interface > httpd.conf template > httpd.conf ]

Working with MAMP directives can sometimes be tricky. If your Apache Server does not start, then check the real httpd.conf file to verify your changes are syntactically correct. All changes made in the interface, as well as the httpd.conf file will eventually flow to your real httpd.conf file. The real httpd.conf file is located in ~/Library/Application Support/appsolute/MAMP PRO. Check the timestamp to verify this file was just created.

SSL Sites

To make changes to your ssl sites use the httpd-ssl.conf template file. Changes in this file will be reflected in the httpd-ssl file located in ~/Library/Application Support/appsolute/MAMP PRO.


Wednesday, February 04, 2015

The .htaccess File and MAMP PRO

The .htaccess file is an Apache Server configuration file. Many content management systems use them. They are used for custom configuration of Apache Server for a host. Changes to the access of your .htaccess file can be made in the General section of the Hosts tab.

Enabling the .htaccess File

By default your MAMP PRO Apache Server is configured with the .htaccess file enabled. The  [ AllowOveride All ] directive allows any directive with .htaccess context to override the Apache Server configuration.

Set the AllowOverride directive to [None] if you wish to disable your .htaccess file.

More information concerning the AllowOverride Directive can be found at the Apache Server website.

The .htaccess File Is Hidden

You will not see a .htaccess file in the Mac Finder because it is a hidden file. An easy way to see if a .htaccess file exists in a directory, or open the file itself, is by using the text editor TextWrangler. From TextWrangler go to File -> Open.  Click Show Hidden Items. You will now see if a .htaccess file is in the directory, and open it if you wish.

Wordpress and .htaccess

Many content management systems will dynamically create .htaccess files to make customisations to Apache Server. One example are permalink settings in WordPress.

Wordpress will create a .htaccess file when you set your permalink settings to anything other than Default. You will not be able to see your blog pages if you have your AllowOverride set to None and your permalink settings set to anything other than Default.

The following is the content of the .htaccess file that is created when you set the permalink to Day and name.

Create Your Own .htaccess File

You can also create your own .htaccess and make your own Apache Server customisations. Use a text editor such as TextWrangler to create a .htaccess file. You may get a warning that you are about to create a hidden file when you do. The following .htaccess file directive will make Apache Server first look for MyCoolIndex.php instead of the customary index.html and index.php.

Add the following line to your newly created .htaccess file:

DirectoryIndex MyCoolIndex.php index.html index.php


Wednesday, January 28, 2015

How to: Creating multiple Apache log files on a per host basis

By default MAMP PRO logs your Apache errors in /Applications/MAMP/logs/apache_error.log. Errors originating from all hosts are entered into this single log file. It may be more convenient to have one log file for each individual host.

Open up your httpd.conf template file (Go to > File > Edit Template > Apache > httpd.conf) and scroll down to the “MAMP_VirtualHost_iteration_begin_MAMP” directive. Inside the httpd.conf template file add the following Errorlog directive (see line 10 in this code snippet).

This will create multiple log files in your /Applications/MAMP/logs directory. They will be named MyHostName1.log, MyHostName2.log, ….

Double check your work in your real httpd.conf file which is created every time you start your Apache server in ~/Library/Application Support/appsolute/MAMP PRO . You should see the following changes under each individual host. The following is the localhost:

There´s a second method to generate multiple Apache log files:
You can create individual Apache error log files through the MAMP PRO interface. In the Hosts tab, under the Extended section you can add the following under the Additional parameters for "VirtualHost": section.


Method 1 - You only have to make one change to your httpd.conf template file and each subsequent host you create will have an Apache error log file created for it without any additional work. The disadvantage is you have less control over the name and location of your custom Apache log file.

Method 2 - You have more control over the name and location of your custom Apache log file. The disadvantage is that you have to enter the custom Apache log file name for each additional host you create. Error messages will appear in the default apache_error.log file If you forget adding a custom Apache error log file name for a particular host.


Tuesday, January 27, 2015

MAMP & MAMP PRO for Windows Preview Release

We´ve released a free preview version of MAMP & MAMP PRO for Windows. It runs under Windows 8.1, Windows 8.0 and Windows 7. A minimum of 2GB free HD space is required.

This version contains all features of the Mac OS X version. You can test the MAMP & MAMP PRO for Windows Preview until 15th of February 2015. After this we´ll provide an advanced beta version of MAMP & MAMP PRO for Windows. The preview can be downloaded here.