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

Getting Your Mac Ready For Mac OS X 10.5 Leopard

Updated 24.10.2007 – There is not many days left (2 days and 22 hours) for the new Mac OS X 10.5 Leopard. Here are couple guides how to prepare for that with the current 10.4 Tiger: Macworld Excerpt: Getting your Mac ready for OS X 10.5 and TUAW Guide: Getting Ready for Leopard. And yet one from MacFixIt: Special Report: Preparing for Mac OS X 10.5 (Leopard) Installation — Avoiding issues before and after updating.

How to Put MacBook Pro to Sleep, Always

There seems to be an sleeping issue with at least Intel based MacBooks.

MacBook / MacBook Pro Reliability:

The superb sleep behavior of PowerBooks and iBooks has long set them apart from ill-behaved PC laptops — nearly instant sleep and wake, with no confusing modes to choose between (do I need “Standby” or “Hibernate”?). But the new Intel-based laptops seem to be having some of the same troubles PCs have long known.

I have the issue and if you search web, there seems to be many others with same problem. The problem is usually that when you put your MacBook to sleep, after few seconds the screen goes blank and the hard drive shuts down but then immediately, the SuperDrive makes a noise and Mac wakes up again. I try to close all the programs and shut down the network storage and bluetooth waking up and put it to sleep again, but no luck. It always wakes up. If I leave it there, it tries to go to sleep again and again and again… Sometimes it goes to sleep, but usually not.

I usually use MacBook with external display. If I run it on batteries without external display, it succeeds to go to sleep more often, but only then.

Apple has an article: Mac OS X: Why your Mac might not sleep or stay in sleep mode. It didn’t help. Apple Support discussions have quite a many threads about the issue, but no answers. The issue is most annoying.

How to Put MacBook Pro to Sleep, Always? I sure would like to know the answer.

Get Started With the New Mac

When you open a new MacBook for the first time, it takes only some minutes to be ready to start using it. Moving from Windows makes me a newbie with Mac. So, what to do first. Apple Support has some good documents, like Swith 101. MacRumors has a good guides, especially Mac Beginner’s Guide.

Guides to get started with Mac:

Opening MacBook Pro for the First Time

At the Mac Store I asked about how to choose the default language for the Mac OS X. He said that I can anytime change the preferred language from System preferences. But when the MacBook is opened the first time, I get to choose the default language of the OS. Well, when I opened it went through all the setup things, but it didn’t ask about the language. Maybe it was the current Country question, but I thought that was only related to the physical location. Now I have different language on login screen and after login.

There are ways to change the default language, but the instructions are for 10.3. Though I guess it’s working also on Tiger.

Update: This method doesn’t change the language of the login window. Still looking the way how to change that.

Scroll to Top