Since I just had to reinstall Leopard and lost all my custom PHP and MySQL installations (and the MySQL databases, unfortunately), I tried to remedy that yesterday and today.
I’m still pissed off that OS X doesn’t come with working PHP and MySQL out of the box, including the PHP libraries. With a simple way to know where the data are being stored, and a way to back it up (in one’s Home folder, perhaps). But I digress–I’m sick of spending hours getting things to work when they ought to work.
So I decided to try out XAMPP for Mac (I tried it a few years back for Windows and enjoyed it), and it worked. Here are a few notes.
1. Everything is installed in the Applications folder. I’m not sure I like this, since I hate having stupid little folders (and DATA) in the Applications folder. I’m not sure if this can be easily changed, perhaps with a symbolic link to somewhere else (such as my Home folder, so it will get backed up).
2. Leopard MySQL was running when I installed, so I had to kill it with ‘sudo killall mysql’ and it will hopefully not start up again when I restart. The main reason I was having issues was that Leopard AGAIN lost mysql.sock.
3. I turned off Web Sharing in System Preferences. This is probably a good thing, and it will at least keep my computer from trying to run two Apache servers at once.
4. I wanted to keep the Sites folder as my web root for localhost, so I opened /Applications/xampp/etc/httpd.conf and changed DocumentRoot to point toward my Sites directory (e.g., “/Users/Matt/Sites”). I then copied everything in /Applications/xampp/xamppfiles/htdocs into /Users/Matt/Sites, and things seem to still work fine.
5. The MySQL databases, in case you want them backed up with the rest of the file structure rather than using phpMyAdmin, are stored in /Applications/xampp/xamppfiles/var/mysql. I may try to move them (with a symbolik link) to be stored in my Home folder since I won’t be keeping a lot of data in them but it’s annoying when I lose settings for various PHP applications (Simple Machines Forum, OpenX, Drupal, Serendipity, etc.).
6. I cannot get MySQL to work if I set a password for it, which means no logging into phpMyAdmin and no access to the MySQL databases. I get “Access denied for user ‘root’@’localhost’ (using password: NO)” instead, until I reset the password to blank. (Note to self, to do this, the command is [sudo ./bin/mysqladmin -u root -p password ”] (no brackets). The -p is important, because it will them ask you for your current password rather than assuming that you just didn’t want to supply it. Idiotic.)
7. Overall, aside from having to install all my databases again (not the fault of XAMPP), it seems to be working well so far. It just miffs me that I have a non-functioning version of MySQL on my laptop as well as an unused (although missing certain useful libraries) version of PHP 5 floating around. At this point I’ll take what I can get.