All about the system administration and application development behind a local linux-based company
My goals for upgrading to PHP 5 are to do it without breaking any customer websites, and also to use few or no legacy options. Hopefully by being strict about legacy options I can prevent pidgin-php that requires a combination of current and depreciated features, as that would make the upgrade to PHP 6 much more of a nightmare. Specifically url_fopen and register_globals will be turned off, and zend v1 compatibility mode will not be turned on. I have decided to leave register_long_arrays on, because of the sheer number of scripts that use $HTTP_*_VARS style formatting, and because there isn’t much harm in that syntax being available. Register_long_vars will be removed from php 6, but I’m willing to deal with that problem when we start looking at PHP 6 (fortunately, a file search to find all of the scripts using that syntax will be trivial).
Because of these substantial changes, I need a way for my customers to preview their websites rendered by the new php, so we can both be confident that when it comes time to flip the switch there won’t be any issues. I’ve done this by installing a new php and apache on an alternate port, and we’ll be emailing customers shortly to have them check their websites on the alternate port to verify they work correctly, and to make support available to customers who aren’t sure about how to fix their pages ( I actually anticipate very few will call).
I’ve always been wary of automatic updates. Certainly, they give you the quickest response time, but at the price of stability. I’d rather know exactly what I’m updating when I’m updating it, so if I run into an issue it’s easier to backtrack where it came from. I find that a happy medium is email notification when updates become available. Since most of my servers are running the same distribution, I fire up clusterssh and update them all at once.
Here’s my yum email notification script (adapted from a script by Michael Heiming):
#!/bin/shmaila="email@address.com"yumdat="/tmp/yum-check-update.$$"yumb="/usr/bin/yum"CHECKWRK='no'#rm -f ${yumdat%%[0-9]*}*$yumb check-update >& $yumdatyumstatus="$?"case $yumstatus in100)cat $yumdat |\mail -s "Alert ${HOSTNAME} updates available!" $mailaexit 0;;0)# Only send mail if debug is turned onif [ ${CHECKWRK} = "yes" ];thencat $yumdat |\mail -s "Yum ${HOSTNAME} no patches available." $mailafiexit 0;;*)# Unexpected yum return status(echo "Undefined, yum return status: ${yumstatus}" && \[ -e "${yumdat}" ] && cat "${yumdat}" )|\mail -s "Alert ${HOSTNAME} problems running yum." $mailaesac# clean up[ -e "${yumdat}" ] && rm ${yumdat}One more thing is that it’s easy to forget to reboot after a kernel update, or put off rebooting because the time you update the RPMs isn’t the best time to update the kernel. To make sure that I do reboot, I’ve written added an email notification script that lets me know when the latest installed kernel is newer than the currently running kernel:
#!/bin/shCONTACTADDR=email@domain.comLATESTKERNEL=`rpm -q kernel |tail -n1|sed -e 's/kernel-//'`if uname -a | grep -qv $LATESTKERNEL; thenecho "Running Kernel is" `uname -r` "but latest installed rpm is ${LATESTKERNEL}" |\mail -s "${HOSTNAME} Reboot required" $CONTACTADDRfi;