COMMANDDUMP – Upgrading from PHP 5.3 to 5.6 on Ubuntu 14.04

COMMANDDUMP – Upgrading from PHP 5.3 to 5.6 on Ubuntu 14.04

When upgrading from PHP version 5.3 to 5.6 there are several things to worry about.  On a shared system with multiple sites which do not make use of a common unit testing or library,  these tools and commands could be useful to find issues.  (this would also work from 5.4 or from 5.5 to 5.6)

COMMAND DUMP of things I ran.

Create a file call 5.4.php.searchterms

#echo import_request_variables >> upgrade.php.searchterms
#echo session_is_registered >> upgrade.php.searchterms
#echo session_register >> upgrade.php.searchterms
#echo session_unregister >> upgrade.php.searchterms
#echo define_syslog_variables >> upgrade.php.searchterms
#echo register_globals >> upgrade.php.searchterms
#echo sqlite >> upgrade.php.searchterms
#echo php_logo_guid >> upgrade.php.searchterms
#echo php_egg_logo_guid >> upgrade.php.searchterms
#echo php_real_logo_guid >> upgrade.php.searchterms
#echo zend_logo_guid >> upgrade.php.searchterms
#echo register_long_arrays >> upgrade.php.searchterms

#find -type f -name ‘*.php’ -exec grep -f upgrade.php.searchterms {} \; -ls

Check the version of your server

#lsb_release -a
#dpkg -l |grep php|grep apache
#php -v
#apache2ctl -vV

To upgrade from ubuntu 14.04 LTS you have to get php 5.6 from another repository as it is not includedin the default repos

apt-get -y update
apt-get install -y software-properties-common
add-apt-repository ppa:ondrej/php5-5.6 -y
apt-get -y update
apt-get -y install php5 php5-cli php5-common php5-curl php5-gd php5-imap php5-json php5-mysql php5-readline

You will be prompted when installing the latest version of PHP5 whether you want to keep the old or new version of PHP5.ini  I chosed to install the pakage maintainer’s version,   then I compare the two and update the new one with the differences.    The following command makes it easy to compare by removing all of the commented lines from the diff against the backed up file

cd /etc/php5/apache2
diff <(grep -v '^\s*;' php.ini|awk '$1 != ""') <(grep -v '^\s*;' php.ini.ucf-old|awk '$1 != ""')|more

I also updated the php.ini date.timezone setting to my area due to this php.net post

date.timezone = America/Boise

/etc/init.d/apache2 reload

Leave a Reply

Your email address will not be published. Required fields are marked *