Upgrade to PHP 7 on CentOS

Well, PHP7 has just been released as you can read on the php.net website. Time to celebrate 🙂 So in this quick tutorial, I will note necessary steps to ugprade to PHP 7 on CentOS, assuming that you are using PHP with FPM with remi repo. Necessary steps are as follows:

  1. First, install yum-utils:

    [bash]yum install -y yum-utils[/bash]

  2. Enable php70:

    [bash]yum-config-manager –enable remi-php70[/bash]

  3. If you are using php-mysql and php-opcache with PHP5-4. these extensions will not be compatible with PHP7. So you will need to remove them:

    [bash]yum remove php-opcache php-mysql[/bash]

  4. Upgrade to PHP7:

    [bash]yum update php\*[/bash]

  5. Install php-mysqli to replace php-mysql extension, and install new opcache one:

    [bash]yum install php-mysqli
    yum install php-opcache[/bash]

    Another way to upgrade php-myql seamlessly:

    [bash]yum shell
    remove php-mysql
    install php-mysqlnd

  6. All done! Enjoy new PHP version

About NhocConan

A super lazy guy who tries to write tech blog entries in English.He is lazy, so he can only write when he is in a good mood or when he is tired of coding.

Leave a comment

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