Upgrading CentOS 5 from PHP 5.1 to 5.3

  • see what is installed (assuming php-mcrypt & php-mhash are installed
yum list installed | grep php | cut -d' ' -f1
typical result:
php.x86_64
php-cli.x86_64
php-common.x86_64
php-devel.x86_64
php-gd.x86_64
php-imap.x86_64
php-ldap.x86_64
php-mbstring.x86_64
php-mcrypt.x86_64
php-mhash.x86_64
php-mysql.x86_64
php-odbc.x86_64
php-pdo.x86_64
php-pear.noarch
php-xml.x86_64
php-xmlrpc.x86_64
  • removes the 16 packages above (make sure there is nothing above you want to keep)
    • Check that only the packages above are listed before you press yes
yum remove php php-*
  • See what php53 provides:
yum search php53 | cut -d' ' -f1 | grep php
  • Notice packages missing: php-mhash php-pear (note mhash is deprecated)
yum install php53 php53-cli php53-common php53-devel php53-gd php53-imap php53-ldap php53-mbstring\
 php53-mysql php53-odbc php53-pdo php53-xml php53-xmlrpc php53-mcrypt
  • Can install php-pear back in again—it seems this doesn’t have 5.1 dependencies
yum install php-pear
  • Have to put back any changes made in /etc/php.ini, e.g.:
    • memory_limit = 128M
    • post_max_size = 40M
    • upload_max_filesize = 20M
  • Find the [Date] section, uncomment the timezone line and add something like:
    • date.timezone = 'America/Toronto'
service httpd restart

Install mcrypt from source

yum install php53-devel libmcrypt-devel gcc
  • first get php version 5.3.6 (above 5.3.6 fails with PHP_FE_END undeclared in devel library)
  • Check latest version here: us2.php.net/releases/#5.3.3
ver=php-5.3.6
cd ~
wget http://www.php.net/get/$ver.tar.gz/from/us3.php.net/mirror
tar xf $ver.tar.gz
  • now run one line at a time:
cd ~/$ver/ext/mcrypt/
phpize
aclocal
./configure
make
make test #to help make PHP better
make install
echo "extension=mcrypt.so" > /etc/php.d/mcrypt.ini
service httpd restart
rm -Rf ~/$ver

Update APC

yum install pcre-devel
pecl install -f apc
  • add extension=uploadprogress.so to /etc/php.ini

Update phpMyAdmin

  • If installed by Rimu script, check here: ls /etc/httpd/conf.d/ to see if yum has renamed conf file
  • Upgrade to new version here: drup.org/upgrading-phpmyadmin

Useful Links