This post won't apply to everyone. If you're a web developer like me and you have a local MySQL database on your Snow Leopard Mac, you'll have noticed that every time you upgrade your OS it breaks MySQL, and the specific nagging error I get after it's up and running again is that a transfer has "exceeded MAX_ALLOWED_PACKET bytes."
Here's the incredibly simple way of dealing with this:
- open terminal
- sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
- edit /etc/my.cnf (this step assumes you're using textwrangler, use whatever you like)
- max_allowed_packet is on line 31, change it from 1M to something more respectable, such as 12M
- save and restart mysql
No more packet errors!
I use my mac to develop websites, and I've had to do some messing around to get my new Leopard 10.5 operating system to be as good a development environment as Tiger was. Here is what I had to do:
MySQL
Turns out that you have to reinstall MySQL on Leopard. Whoops! I guess I lost my old databases when I upgraded. I should figure out a way to have them save in my user folder. Anyway, go here to get the PKG files. The MySQL preference pane is busted and so is Navicat, so I went and got the official MySQL GUI Tools to set everything up again.
PHP
For these next steps it's helpful to have Textwrangler to edit your system files.
- Open terminal, and type sudo touch /private/etc/php.ini.
- Then go to TextWrangler, and File > Open Hidden /private/etc/php.ini.default and copy all.
- Open /private/etc/php.ini and paste all into there.
- Remove the semicolon (uncomment) line 625, which should be extension=php_mysql.dll
- On line 760, make it read mysql.default_socket = /private/tmp/mysql.sock
- Save and close the file.
Apache
To get PHP working on Apache (ht to SiteCrafting for this):
- In TextWrangler, open the hidden file /private/etc/apache2/httpd.conf
- Remove the poundsign (uncomment) line 114 which should be about the php5_module
- Also I added the following two lines at line 405:
- AddType application/x-httpd-php .php
- AddType application/x-httpd-php-source .phps
Also I use Apache virtual hosts so I can develop multiple sites. I keep these sites in my sites folder. If you're like me, you'll want to:
- Still in httpd.conf from above, change the DocumentRoot directory to be "/Users/josh/Sites" (your username instead of Josh, obv)
- Change the directory at line 190 to match what you put above
- Save / close
- Open /private/etc/apache2/extra/httpd-vhosts.conf and add your virtual hosts, then save and close. I use variations of:
DocumentRoot "/Users/josh/Sites/joshreisner.com/www/"
ServerName joshreisner.site
ServerAlias www.joshreisner.site
To get those local addresses working, you can't use the NetInfo Manager like you could in Tiger. Assuming you have installed the command line tools in TextWrangler > preferences, you can
- go to terminal and type edit /etc/hosts
- duplicate the line that says 127.0.0.1 localhost
- replace localhost with your servername, eg joshreisner.site from above
- save and close
Finally, I had trouble setting permissions on my Sites directory using Finder (it crashed every time I tried). Here's what I did, which I don't advise as a long-term solution because it's too generous with the permissions:
- go to terminal and type sudo chmod -R 777 /Users/josh/Sites
Now you can go to System Preferences > Sharing and start web sharing and you should be all set. Good luck!