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

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

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.

Getting Your Mac Ready For Mac OS X 10.5 Leopard Read More »

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.

How to Put MacBook Pro to Sleep, Always Read More »

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:

Get Started With the New Mac Read More »

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.

Opening MacBook Pro for the First Time Read More »

From Windows XP And Vista to Mac OS X

Mac OS XAfter using Microsoft Windows XP for a long time and trying Windows Vista for a while, I realized it’s time to move on… Move on to Apple Mac OS X. There are couple reasons to get away from Windows:

  • Windows XP was taking way too much time to administer it
  • after a clean install Windows XP was working like a charm for a while, but after installing some applications it was getting slower and slower…
  • Windows Vista was too slow in my old PC, I would have needed some new hardware
  • Visual appearance in Windows Vista is in my opinion terrible, sure there are something glamorus in Aero, but the combination of green and blue everywhere…

So, what were and are overall goals for the switch?

  • To minimize the needed hardware and software to do all the required tasks
  • To minimize needed administration time, both hardware and software
  • To have a visually appealing environment, both hardware and software

I admit I didn’t know that much about Mac OS X, but it was looking promising. It’s based on Unix, it’s visual appearance is clean, administration should be easy… And now after couple of weeks, I must say things are looking good. At the moment I’m exploring ways to migrate from Windows applications Mac applications. I’ll get into details later on…

From Windows XP And Vista to Mac OS X Read More »

Scroll to Top