Jump to content

Need help with MAMP on Mac OS X


David B

Recommended Posts

This is all terribly confusing for me, so bear with me if I have a hard time explaining it. I want to set up Apache, PHP, MySQL and phpMyAdmin on a new MacBook Pro, so I downloaded a preconfigured package called MAMP. I beat my brains out trying to get virtual hosts to work and finally gave up on trying to establish a database connection - deciding to work with my online database instead - only to discover that I have TWO Apache installations running, and my virtual hosts are apparently linked to the original Apache, not the newer (MAMP) version. I also learned that my .htaccess files aren't working.

 

I learned how to turn off my default Apache program, either by typing "sudo killall httpd" into Terminal, then using my MAMP icon to turn Apache #2 back on, or by going into System Preferences and disabling Web Sharing. This appears to be working, because I can access phpMyAdmin at http://localhost:8888/phpMyAdmin/ AFTER I've disabled Apache #1. I further confirmed it by deleting the contents of my newer (MAMP) httpd.conf file, which killed phpMyAdmin. (I pasted the contents back, of course.)

 

I also took someone's advice and added the following line to my newer (MAMP) httpd.conf file:

 

PidFile /private/var/run/httpd.pid

 

According to this article...

 

http://rexselin.wordpress.com/2006/07/28/making-mod-rewrite-and-htaccess-work-on-mac-os-x/

 

....htaccess files don't work on Mac's unless you do the following:

 

 

1) Open the httpd.conf file and uncomment these three lines:

 

#LoadModule rewrite_module modules/mod_rewrite.so

#AddModule mod_rewrite.c

#AccessFilename .htaccess

 

> The 2nd and 3rd lines were already uncommented. The closest I found to the first line was the following, which was also uncommented:

 

LoadModule rewrite_module libexec/httpd/mod_rewrite.so

 

I left it alone.

 

 

2) Change "AllowOverride None" to "AllowOverride All" in both the httpd.conf and /private/etc/httpd/users/MyName.conf files.

 

 

3) Restart Apache.

 

I tried it once, but it killed all my websites. Also, there are several instances of Allow Override None in my newer httpd.conf file, and I'm not sure if I'm supposed to change all of them or just a certain one(s). It's all hopelessly confusing.

 

I should also mention that I got my virtual hosts to work with Apache #1 only after making two changes:

 

1) I deleted every reference to 127.0.0.1 in my original httpd.conf file, even though I use 127.0.0.1 in my hosts file.

 

2) I changed everything in NetInfo to lower case, even if I used caps in my httpd.conf and hosts files.

 

This is what my virtual host settings currently look like. I've been changing them back and forth between *:80 and 127.0.0.1:80, but nothing seems to work.

 

In summary, it looks like I now have a single Apache version (MAMP) running, and it seems to be connected to MAMP's httpd.conf file, but I still have to figure out how to make my virtual hosts work again. Thanks for any tips!

 

* * * * * * * * * *

 

NameVirtualHost *:80

 

# Leave this one alone - it makes sure that localhost works.

<VirtualHost 127.0.0.1:80>

DocumentRoot /Library/WebServer/Documents

ServerName localhost

</VirtualHost>

 

<VirtualHost 127.0.0.1:80>

ServerName Geobop

ServerAdmin [e-mail address]

DocumentRoot /Users/MyName/Sites/Geobop

</VirtualHost>

 

<VirtualHost 127.0.0.1:80>

ServerName GW

ServerAdmin [e-mail address]

DocumentRoot /Users/MyName/Sites/GW

</VirtualHost>

 

<IfModule mod_php4.c>

    # If php is turned on, we repsect .php and .phps files.

    AddType application/x-httpd-php .php

    AddType application/x-httpd-php-source .phps

 

    # Since most users will want index.php to work we

    # also automatically enable index.php

    <IfModule mod_dir.c>

        DirectoryIndex index.html index.php

    </IfModule>

</IfModule>

 

<IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteCond %{REQUEST_METHOD} ^TRACE

    RewriteRule .* - [F]

</IfModule>

 

<IfModule mod_bonjour.c>

    # Only the pages of users who have edited their

    # default home pages will be advertised on Bonjour.

    RegisterUserSite customized-users

    #RegisterUserSite all-users

 

    # Bonjour advertising for the primary site is off by default.

    #RegisterDefaultSite

</IfModule>

 

Include /private/etc/httpd/users/*.conf

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.