Warning: Use of undefined constant ddsg_language - assumed 'ddsg_language' (this will throw an Error in a future version of PHP) in /home/wpsrv679/public_html/minimizr.com/wp-content/plugins/sitemap-generator/sitemap-generator.php on line 44
Setup MAMP (Mac, Apache, MySQL And PHP) on Mac OS X 10.5 Leopard - Minimizr

Setup MAMP (Mac, Apache, MySQL And PHP) on Mac OS X 10.5 Leopard

New Mac OS X 10.5 Leopard comes with new versions of Apache and PHP (Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2 PHP/5.2.4), so it is quite easy to setup a MAMP server. Sure there are other ways to do the setup: You can build Apache, MySQL and PHP from sources, you can use MacPorts or you can use pre-build packages like MAMP or XAMPP. But in my opinion, because Apache and PHP are already installed, they are easy way to go and will minimize you work.

Table of Contents

Apache

To enable pre-installed PHP, you have to edit httpd.conf file:

sudo vi /private/etc/apache2/httpd.conf

And uncomment next line:

LoadModule php5_module libexec/apache2/libphp5.so

If you want to make other configuration changes, for example define virtual hosts, it’s better to use user’s configuration file:

sudo vi /private/etc/apache2/users/[username].conf

After making changes, restart Apache aka Web Sharing. Go to System Preferences > Sharing and unselect and select again Web Sharing. That’s it. Now you have the Apache and PHP running. If there are any problems, you can examine the Apache error_log. Go to Console > /var/log > apache2 > error_log.

PHP

If you want to make changes to php.ini, do the following. Copy php.ini.default to php.ini:

sudo cp /private/etc/php.ini.default /private/etc/php.ini

And to make changes:

sudo chmod 644 /private/etc/php.ini
sudo vi /private/etc/php.ini
sudo chmod 444 /private/etc/php.ini

After making changes don’t forget to restart Apache.

MySQL

MySQL is a little trickier. It is not pre installed in OS X and in my opinion easiest way is to use binary from MySQL.com. So, download the current version, which is mysql-5.0.45-osx10.4-i686.pkg at the moment and install it. Then install MySQLStartupItem.pkg and copy MySQL.prefPane to OSX/Library/PreferencePanes. It seems to be that current versions preference pane is not quite compatible with OS X 10.5. It shows if the server is running or stopped, but you can’t star or stop with it. MySQL starts when the OS starts, but you can start or stop it manually from console:

sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

MySQL with default settings use socket in /tmp and pre-installed PHP presumes it to be in /var/mysql, so you have to update the location in php.ini:

mysql.default_socket = /tmp/mysql.sock

Perhaps you could also use a symbolic link from /var/mysql/mysql.sock to tmp/mysql.soc. MySQL GUI Tools are also working nicely with new OS X 10.5.

Mac OS X 10.5

No you should have a MAMP server running nicely. If you want to make host name changes – for example you can use different names for localhost to take advantage Apache’s virtual hosting – edit hosts file:

sudo vi /private/etc/hosts

1 thought on “Setup MAMP (Mac, Apache, MySQL And PHP) on Mac OS X 10.5 Leopard”

  1. This article was my beacon of light for about a week. I’ve had it pinned on Chrome.

    You made the php part so painless, and I have to thank you for that. Realizing that php was already installed on my Mac made me say “Oh! Freakin’ awesome!”

    So painless that the second half was just vague enough that it’s been one of the worst experiences I’ve ever had in my life. It seems no one knows for sure how mysql is supposed to be installed on a mac. Those who step up to the plate, tackle its flaws with few words, and/or in a game of telephone someone starts thinking that you’re using linux and then none of the commands they’re telling you to use work.

    There were a number of problems. The most infamous: Error 2002: Can’t connect to local MySQL server through socket ‘/etc/mysql.sock’ (2)

    How many times did people tell me to move .cnf files from my local folder in to /var? Files that I never had in the first place. And why were all the error logs always completely blank? Some people tried resorting to creating a blank file to no avail. Others tried explaining that the mysql user didn’t have permissions to its own files. …Seriously? Why the F*** not? Plenty more people explained, like yourself, that you had to change the .sock location in the php.ini, but there was no .sock file anywhere in /tmp or /var/mysql. Where is it? I don’t know.

    A week is a long time to get hazed with errors and bad fixes. Somehow, miraculously, I understood this morning how to get MAMP.info’s package working, and I think I’m just going to settle for that. I’m still interested, I suppose in making my install of mysql work (if for no other reason that it’s taking up hard drive space now), but I honestly think it just WON’T let me.

Leave a Comment

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

Scroll to Top