Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Restore PHP, MySQL, etc. after a fresh OS X install UNIX
Yesterday, when I tried to run the 10.4.6 updater on my Dual G5, it locked up just before the end of the progress bar -- all apps went spinning beachball, and force quit had no affect. I had no choice but to power down manually, after waiting about 45 minutes to make sure it was really and truly locked up.

When the machine rebooted, it booted onto another partition, which was running 10.2.7. That was a bad sign. The 10.4 partition showed up, and all data seemed usable. I quickly made another backup of my key user files (even though I was current as of the day before), then set out to fix the drive. Disk Utility found and fixed a couple problems, but I still couldn't select the partition as my startup drive. Disk Warrior wasn't able to rebuild the directory -- it hung on the final "writing new directory" step. Stumped at this point, I could have restored an old clone, but there's well over 100GB on that partition, and that would take a long time. So instead, I opted to do an archive and install of OS X, with the Retain User Settings option enabled. This archives your current OS X installation, installs a new copy of OS X, then moves all your user data into the new system.

After rebooting and running the Combined 10.4.6 Updater, along with about 15 other updates, the machine was basically perfectly healthy again -- except for the various Unix bits I had installed myself -- things like customizing my Apache configuration file, all my web site stuff in the WebServer directory, my MySQL installation (along with all the databases), and my PHP installation (I use the version on entropy.ch, not the bundled PHP). All of these things live in the Unix side of the system, which was obviously wiped clean with the new OS X install.

Getting them back was relatively trivial, but I thought I'd take a few minutes to document what steps I took...

Fixing PHP and MySQL turned out to be very easy, since the complete installations live in the /usr/local folder. You just have to copy that folder back from the Previous System folder to the proper location in the new setup. (Note that I'm showing cd commands just to make the lines a bit shorter and the context clearer; you could clearly specify the full path on the cp command itself.)
$ cd /Previous\ Systems.localized/Previous\ System\ 1/usr/
$ sudo cp -Rp local /usr/local
The -Rp means "copy Recursively, Preserving as much of the date, time, flag, mode, user ID, and group ID values as possible." Once that was done, I just had to copy back my customized httpd.conf file:
$ cd /Previous\ Systems.localized/Previous\ System\ 1/etc/httpd
$ sudo cp httpd.conf /etc/httpd/httpd.conf
With these steps done, I had all my MySQL databases back, my customized Apache configuration file, and a full PHP install, along with my tweaked php.ini file (as it resides in the /usr/local/php folder). What I didn't have back were all the websites from the WebServer folder. I got these back in the Finder, just by dragging and dropping from the Previous System's WebServer folder into the new WebServer folder.

With all that done, I fired up my browser, and was very happy to find that I could once again update macosxhints via the local database copy. Everything seems to be running fine, which I guess is expected, but it always amazes me when something like this actually works.

I'm sure there are a few more files on the Unix side of the world that I've missed, so I'm keeping the old Unix folders around for a while longer yet. But generally speaking, a clean install with the preserve user settings option enabled is a very fast way to get a dead system back on its feet.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[16,196 views]  

Restore PHP, MySQL, etc. after a fresh OS X install | 15 comments | Create New Account
Click here to return to the 'Restore PHP, MySQL, etc. after a fresh OS X install' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: aptmunich on Apr 04, '06 08:14:51AM

I had a similar experience:

My iBook rebooted and then the flashing ? folder popped up briefly.

The system then booted into 10.4.6 but beachballed.
I had to cut power and restart.

It then booted off my connected backup drive instead of the internal drive.
After another reboot of the 10.4.6 system everything seems to be fine.




[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: morespace54 on Apr 04, '06 09:08:16AM

Don't forget that the 10.4.6 update needs 2 restarts (for PPC version only)



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: cheesy9999 on Apr 04, '06 09:49:24AM

Is MySQL installed in Mac OS X (not Server) by default? I thought it wasn't, but if so how do I enable it?



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: pub3abn on Apr 04, '06 10:11:37AM

No, it's not.



[ Reply to This | # ]
Bailing on a bad restore
Authored by: heavyboots on Apr 04, '06 10:38:26AM

Don't forget that if you downloaded the combo updater, you may even be able to successfully eject from the hozed install situation. Reboot off your CD, diskutil the disk back to health, then (hopefully!) reboot into single user. If you make it into single user mode, you can probably just cd ~/Desktop (or where ever you left the disk image of the updater) and then use hdiutil to mount it. Then run installer -pkg /Volumes/Updater-Name/Package-Name.pkg -target /. Since the combo updater writes complete apps, it will probably overwrite the damaged versions from the initial unsuccessful attempt with clean versions.

Had to do this routine with 10.4.4 to escape from starting the update with an (apparently) bad directory.



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: Baggins on Apr 04, '06 12:05:54PM
"except for the various Unix bits I had installed myself -- things like customizing my Apache configuration file, all my web site stuff in the WebServer directory, my MySQL installation (along with all the databases), and my PHP installation (I use the version on entropy.ch, not the bundled PHP). All of these things live in the Unix side of the system, which was obviously wiped clean with the new OS X install. "


Sounds to me like you have the key here as to why your system locked up on the update. It would be a fairly simple (although tedious) thing to test.

[ Reply to This | # ]

Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: gcastaneda on Apr 04, '06 01:55:17PM

I always turn to this site to *try* and stay on top of things. However, from what I've read so far on this update, I have a dumb question to ask: is this a "safe" and straighforward upgrade for us who are anot unix- or terminal-savvy? Should I "expect" to get hindering results as those expressed in this post? Thanks!



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: pub3abn on Apr 04, '06 03:55:32PM

Personally I have not tried Rob's technique, but my thoughts are that you could run into snags that you might rather avoid. A simpler option is to get the PHP and MySQL downloads that come with standard installers (instead of needing to compile them, etc.). Then, all you need is to install those and restore the backup (you have one, right?) of your MySQL data folder. You may need to set ownership and permissions of the restored MySQL data folder, but that is a task that should be easy enough for even a UNIX newbie. It could all be done in about 5-10 minutes I think. No obscure terminal commands needed.



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: robg on Apr 05, '06 06:57:16AM

I think this question was more generally targeted to "is 10.4.6 safe to install?"

The answer is seemginly yes, though a few folks have had issues such as mine. But my mini and PowerBook both updated fine, as did the wife's machine. Only the G5 had issues...

-rob.



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: gcastaneda on Apr 05, '06 08:54:50AM

Thanks guys! I appreciate your feedback! Both of you were right on each of the two important aspects of an upgrade :-) I will just have to be extra careful making my backups before the upgrade.

Cheers!



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: rspeed on Apr 04, '06 06:37:48PM

The first issue (the drive going wonky) and second issue (getting the services running again) hardly seem related.



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: robg on Apr 05, '06 06:54:23AM

No, they aren't. It was just a good reason to write about what I did to get things running again.

-rob.



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: gcastaneda on Apr 05, '06 10:31:24AM

Well, after backing up everything, I installed the update. Everything went quite well. I walked away from my iBook when it restarted and a couple minutes later everything seemed to work just fine. Since I didn't know if the second restart was automatic, I shut down and powered back on again (just in case!). Everything works, even MySQL (haven't tried PHP...maybe this time around I *will* make it work hehe).



[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: tonyh on Apr 07, '06 10:18:01AM

I've been using MAMP for developing, and it came through the 10.4.6 upgrade just fine.

MAMP is a packaged-up Apache-PHP-MySQL stand-alone environment for Mac OSX. No tweaking of config files neccessary.

Check them out here:

http://www.mamp.info/en/home/

Disclaimer: I have no affiliation with the company. Just like the product!

[ Reply to This | # ]
Restore PHP, MySQL, etc. after a fresh OS X install
Authored by: rahulbenegal on Jun 01, '06 05:57:53AM

Each time i do a OS X upgrade i seem to lose mysql and its data, php setting, Rails and i have no idea what else.
(In the Linux world, i used to install into my own dir such as /opt or /sw and never in /usr/local, so that upgrades would leave my software alone).

However, as i understand it, in the DMG world this is not possible? DO all of you keep reinstalling mysql etc after each upgrade or do you have a smoother solution ?

Anyway, i found my data in the /Previous Systems folder and copied back, but i dont know what else is lost.... Suggestions welcome.

rahul benegal



[ Reply to This | # ]