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
    run
    quit[/bash]

  6. All done! Enjoy new PHP version

Leave a comment

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