MAMP apache freezing

I’ve switched to MacBook Pro Retina in November after repeating frustrations with different WiFi adapters in an HP ProBook 450 G1 on Ubuntu.

I always read that MAMP/WAMP/XAMP is for ‘less experienced’ developers, while native installation (via homebrew on Mac) of software is for ‘mature’ ones. Honestly, I don’t think it matters – it’s the same software after all. It just comes preconfigured differently, and I don’t really see why experienced people wouldn’t take advantage of (for example) switching a PHP version with couple of clicks, as long they are capable of modifying configurations appropriately.

So, a Joomla site, requiring PHP 5.2 for historical reasons worked and debugged perfectly out of the box.

However, with a rather heavy Symfony2 application and Xdebug turned on, browser just gets caught loading a page forever, in matter of minutes. This was never an issue on Ubuntu.

Googling for possible issues with mac, I found that .local tld is not favorable due to Bonjour conflict, so I’ve switched to .dev, with no luck. Also, I’ve decided to move the virtual host name resolution from /etc/hosts to dnsmasq (thanks to – no luck again, despite both of hints being quite useful.

Finally, since the processor was idle during these mishaps, I’ve decided that it must have been apache that for some reason had become unable to process the requests.

I’ve decided to look into Ubuntu default apache configuration, and spotted 2 major differences right at the top. KeepAlive is never mentioned, and mpm_prefork_module (extra/httpd-mpm.conf) was commented out in MAMP apache configuration.

I’ve turned these on, and there we go! As I’m writing this, the page is loaded, and hits the server with a request each minute and everything still works 🙂

However, Xdebug is also confirmed to make a difference – when turned off, the benchmarked requests take below 1 second consistently. With Xdebug turned on, they take somewhere between 1.5 and 20 seconds. No breakpoints.

This entry was posted in Infrastructure, Linux, Mac, Tools and tagged , , , , . Bookmark the permalink.

2 Responses to MAMP apache freezing

  1. v. says:

    UPDATE: the KeepAlive related configuration (along with “Various default settings”) is in /Applications/MAMP/conf/apache/extra/httpd-default.conf which is not included (commented out) by default.

  2. v. says:

    UPDATE: I found out more ways to speed up MAMP, by fixing php.ini:
    – disable opcache
    – disable imap extension
    – add your hostname (as configured) to /etc/hosts or dnsmasq configuration

Leave a Reply

Your email address will not be published. Required fields are marked *