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.

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

{ 0 comments }

Getting Your Mac Ready For Mac OS X 10.5 Leopard

October 23, 2007

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 [...]

Read the full article →

How to Put MacBook Pro to Sleep, Always

July 28, 2007

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 [...]

Read the full article →

Get Started With the New Mac

July 26, 2007

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 [...]

Read the full article →

Opening MacBook Pro for the First Time

July 25, 2007

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 [...]

Read the full article →

From Windows XP And Vista to Mac OS X

July 24, 2007
Read the full article →

Disk Wiping with Norton Ghost GDisk

May 13, 2007

Norton Ghost GDisk Pros: can be used from Windows command line can be used also for USB connected disks Cons: Slow? Usage example: gdisk32 gdisk32 [disk number] /diskwipe /dod Other disk wiping solutions: Disk Wiping Utilities: How to Get Rid of Your Data Permanently

Read the full article →

Sitemesh 2.3?

December 20, 2006

SiteMesh is an excellent web page layout framework for Java. Latest version for couple years have been 2.2.1. No it seems to have updated silently to a version 2.3. Nice!

Read the full article →

Choose Your Web Typography with CSSTYPE

December 6, 2006

CSSTYPE is a nice tool for comparing different fonts and css parameters for web typography. You can use our own text samples. Added into the Minimal CSS list.

Read the full article →

CSS Rounded Corners With CSS3

December 4, 2006

While we are now doing CSS rounded corners in many different ways, there is in the future a promising easier way with up to eight background images per element. Nice, after CSS3 is ready and fully supported by browsers…

Read the full article →