Running "yum install php" installs PHP 5.3 on CentOS 6. We want 5.5 at a minimum. Note that if you do install with yum, then regret your decision, to remove PHP with yum you may have to do the following:
yum remove php
yum remove php-cli
yum remove php-common
In developing the following procedure the following tutorials were used: 1 and 2
Many dependencies need to be installed. Most of them can be installed with straight yum, but libmcrypt-devel cannot. There is no yum package "libmcrypt-devel" (or libmcrypt, for that matter). To install it, you must do some manual setup first. See http://benramsey.com/blog/2012/03/build-php-54-on-centos-62/ for more info.
Change to user home directory:
cd ~
If you're on a 32-bit system
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
If you're on a 64-bit system
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Then run these:
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm # Verifies the package
rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
yum install libmcrypt-devel
To install other PHP requirements, perform the following. First should determine what all of them do and figure out if they're needed. Also check to see if they actually install via yum...would totally have missed libmcrypt-devel.
yum install \
curl-devel \
libc-client-devel.i686 \
libc-client-devel \
libxml2-devel \
libXpm-devel \
gmp-devel \
libicu-devel \
t1lib-devel \
aspell-devel \
openssl-devel \
bzip2-devel \
libcurl-devel \
libjpeg-devel \
libvpx-devel \
libpng-devel \
freetype-devel \
readline-devel \
libtidy-devel \
Download PHP 5.6.10 and unpack it.
Note: Need to check into MediaWiki's and SMW's requirements and figure out what makes sense to download.
cd ~/mezadownloads
wget http://php.net/get/php-5.6.10.tar.bz2/from/this/mirror -O php-5.6.10.tar.bz2
tar jxf php-5.6.10.tar.bz2
cd php-5.6.10/
Configure and make PHP. Need to determine if this configuration is right, but it's a start. @todo: figure out what we need.
Note: this takes a while, particularly the "make" step.
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-zlib-dir \
--with-regex \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-soap \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--with-zlib \
--enable-inline-optimization \
--enable-mbregex \
--enable-opcache \
--enable-fpm \
--prefix=/usr/local/php
make
make install
Create a new profile file to add php to path
echo "export PATH=/usr/local/php/bin:\$PATH" > /etc/profile.d/php.sh
Copy files from PHP source (e.g. ~/mezadownloads/php-5.6.10/php.ini-development) to /usr/local/lib
cp php.ini-development /usr/local/php/lib/php.ini
Confirm this line exists and is not commented out in /usr/local/apache2/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
Add the following below the section with all the "LoadModule" statements:
<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule !php5_module>
<FilesMatch "\.ph(p[2-6]?|tml)$">
Order allow,deny
Deny from all
</FilesMatch>
</IfModule>
Restart Apache:
service httpd restart