Notes: Apache, MAMP

Because I don’t want to loose time with those things the next time I setup MAMP, I decided to write it down. I hope it will help you too!

mod_rewrite doesn’t work?

Make sure mod_rewrite is enabled:

LoadModule rewrite_module modules/

Check you httpd.conf (or apache.conf) settings, specially the following setting: AllowOverride

AllowOverride All

You can put inside a Directory block, in a virtual host for example:

<VirtualHost *:8888>
DocumentRoot /path/to/web/root
<Directory "/path/to/web/root">
AllowOverride All

This is valid for any Apache bundle (MAMP, WAMP, XAMP, or Apache itself)

MAMP mySQL – connection problem?

If you’re having trouble connecting to MySQL (using PDO for example), try the following tip:

edit in /Applications/MAMP/bin and add the following line at the end:

ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock &

.htpasswd Apache Tips

To create the file

sudo htpasswd -c  .htpassword.CLIENT.PROJECT USERNAME

To add users to it

sudo htpasswd  .thenameofthefile USERNAME2

to configure a website (vhost) to use that file

 <Directory "/var/www/staging/PATH/TO/CLIENT/PROJECT/web">
        Options -Indexes
        AuthName "TD Staging Server"
        AuthType Basic
        AuthUserFile /var/www/staging/td/.htpassword.CLIENT.PROJECT
        Require valid-user
        AllowOverride All
        Allow from All