Upgrade PHP Linux PHP 5.3.3 with ioncube loader CentOS 5 and Red Hat 5 with Plesk control panel

Guide to upgrade PHP Linux. PHP 5.3.3 Red Hat, CentOS.

1. Remove currently installed PHP.

Without Plesk.

rpm -qa | grep php | xargs rpm -e --nodeps

With Plesk. This is required as the output of rpm -qa | grep php would also pass some Plesk packages to xargs rpm -e --nodeps and Plesk would be broken!

Using the grep -v psa will remove any output containing psa.

rpm -qa | grep php | grep -v psa | xargs rpm -e --nodeps

Personally I advise you check the output of.

rpm -qa | grep php

and,

rpm -qa | grep php | grep -v psa  

before piping to xargs.

2. Install PHP 5.3.3.

yum install php53* php53-*

3. Install the ioncube loader.

Download and extract the ioncube loader and install the ioncube loader module.

x86,

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && cd ioncube && cp ioncube_loader_lin_5.3.so /usr/lib/php/modules/

Now update the PHP config.

echo “zend_extension=/usr/lib/php/modules//ioncube_loader_lin_5.3.so” > /etc/php.d/ioncube-loader.ini

x86_64.

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && tar -zxf ioncube_loaders_lin_x86-64.tar.gz && cd ioncube && cp ioncube_loader_lin_5.3.so /usr/lib64/php/modules/

Now update the PHP config.

echo “zend_extension=/usr/lib64/php/modules//ioncube_loader_lin_5.3.so” > /etc/php.d/ioncube-loader.ini

4. Create dummy PHP package (Optional only required for Plesk  as it does not look for PHP53 packages only PHP.

Install rpmbuild.

yum install rpm-build

Create the php.spec.

nano -w php.spec

Include the following in the file.

Summary: Empty PHP required as Plesk doesent recognise the PHP53 packages.
Name: php
Version: 5
Release: 3.3
License: Public
Group: Applications/System
%description
Empty PHP RPM
%files

press ctrl+x to exit and save the file.

Now build the RPM.

rpmbuild -bb php.spec

This will then output a path to the created RPM.

Install the package

rpm -i /path/to/rpm

Exclude PHP from the main repos.

open the yum config.

nano -w /etc/yum.conf

add the following entry.

exclude=php

The exclude php is to prevent issues with php packages conflicting with php53. It wont stop php53 packages from updating.

5. Restart Apache

service httpd restart

Now check the version of PHP

php -v

Job done.

 

Linux, PHP, Plesk Linux, Virtual & Dedicated Servers , , , , , ,

8 responses to Upgrade PHP Linux PHP 5.3.3 with ioncube loader CentOS 5 and Red Hat 5 with Plesk control panel


  1. Cedric

    Thanks for the guide worked a treat!

  2. Jenna

    Whats with the && what does that do?

  3. box-admin

    @ Cedric cool.

    @Jenna the && is BASH logic its the and gate from an Electronics/Physics perspective. I will make a more in depth guide at some point though.

    Basically it will execute command2 after command1 has completed successfully. If command1 fails command2 would not be executed. So it executes 1 command AND then another command.
    i.e
    wake up && get dressed, if you dont wake up you wont get dressed.

  4. Jay

    Hi, thanks a lot for this guide, but it leaves me with a couple questions.

    – Will this enable Plesk 9.5.4 to use PHP53?
    – Do I need to do anything in Plesk after doing this or will it automatically recognize it’s using PHP53?
    – What about updating to PHP 5.4.x when it becomes necessary?

    Thanks

  5. box-admin

    Hi Jay glad to be of help, to answer your questions.

    1. It will enable Plesk 9.54 to recognise the PHP53 paackages. Step 4 is required for this is it only looks for PHP and not PHP53.

    2. If PHP shows as not installed in the Plesk installed components just restart Apache and Plesk.

    3. Im not sure about that at this point, this guide was written for Red Hat 5 and CentOS 5 which ships both PHP 5.1.6 and PHP 5.3.3 as separate packages so it all depends how and if they ever put PHP 5.4.x ever in the repos, but will either be an update of the existing packages

    yum update php53*

    or remove current and replace

    rpm -qa | grep php53 | grep -v psa | rpm -e –nodeps

    yum install php54*

  6. Jay

    Thanks. I successfully upgraded my server with your instructions.

    However, I did get an error when trying to remove the ionCube Loader for PHP 5.2. Don’t know how that got there though because the server had PHP 5.1.6 installed. I’m sure it won’t be a problem though.

  7. box-admin

    The version of Ioncube loader with PHP 5.1.6 is usually Ioncube loader 5.2 so this is where the 5.2 version comes from.

    Sounds like your php.ini file is referencing the old version or doesn’t include /etc/php.d/

    Whats the output of php -v ?

  8. gvillegas

    thanks a lot buddy! It works nicely!

Leave a Reply

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

six + fifteen =