The Problem
On a recent consulting engagement, I was
tasked with helping a school eliminate a severe performance issue on
its Moode site. I determined the primary solution was to add a PHP
accelerator such as APC or OPCache.
Red Hat still supports RHEL 5 for
security updates, but the default PHP installation is rapidly
becoming unusable for current versions of Moodle. The server's
administrators had manually upgraded from the PHP 5.1 version
included by Red Hat to a third party PHP 5.3 build. While this
allowed them to install a newer version of Moodle, it also ruined the
sites performance. The third party build didn't include a PHP
accelerator. Because the site was in active use there wasn't enough
time to upgrade the entire operating system.
After discusion, with the client, we
decided the best option forward was to upgrade to PHP 5.5 and use
OPCache for PHP acceleration. This had the additional benefit of
making the server ready for Moodle 2.7 and beyond. Here is how we did
it.
The solution
We determined we could get a high quality PHP 5.5 build from the Remi repository (http://rpms.famillecollet.com/) that would continue to receive security updates. OPCache is included with PHP 5.5 and beyond.Setup Remi repository (from cli)
wget
http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
wget
http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm
See
http://linuxdrops.com/how-to-add-epel-and-remi-repository-to-centos/
Remove old PHP (from cli)
yum remove php
php-soap php-intl php-cli php-mbstring php-common php-pdo php-gd php-xml php-ldap php-mysql php-xmlrpc
Install new PHP (from cli)
yum --enablerepo=remi,remi-php55
install php httpd
php-soap php-intl php-cli php-mbstring php-common php-pdo php-gd php-xml php-ldap php-mysql php-xmlrpc php-opcache
See
http://www.if-not-true-then-false.com/2010/install-apache-php-on-fedora-centos-red-hat-rhel/
OpCache Configuration
See the following Moodle docs page for
Moodle specific OPCache settings http://docs.moodle.org/26/en/OPcache
Risks
Some risks to consider before upgrading
Upgrading PHP can break older PHP applications
Make sure that your
version of Moodle will work with a new PHP including all third party
plugins. Also be sure any other PHP web applications are your server support the new version.
The new install may fail
There is also a chance that if you do
something wrong in the repository setup or have an unusual
configuration that you won't be able to successfully install the new
version after removing your old PHP, so plan accordingly!
Missing PHP libraries
Each PHP build is different, not every build includes files for every library. Make sure the library you need are in the new version.
No comments:
Post a Comment