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:
    yum install -y yum-utils
  2. Enable php70:
    yum-config-manager --enable remi-php70
  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:
    yum remove php-opcache php-mysql
  4. Upgrade to PHP7:
    yum update php\*
  5. Install php-mysqli to replace php-mysql extension, and install new opcache one:
    yum install php-mysqli
    yum install php-opcache

    Another way to upgrade php-myql seamlessly:

    yum shell
    remove php-mysql
    install php-mysqlnd
  6. All done! Enjoy new PHP version

Leave a Reply