Can't install php-xml, php-mbstring etc. in php 7.0

February 3, 2018 152 views
PHP PHP Frameworks CentOS

I'm trying to install php7.0-xml, php7.0-mbstring etc. but there's an error in my centos machine.

sudo yum install php7.0-xml
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirror.vodien.com
  • epel: mirror.23media.de
  • extras: mirror.vodien.com
  • ius: mirrors.ircam.fr
  • updates: centos.shinjiru.com No package php7.0-xml available. Error: Nothing to do

sudo yum install php7.0-mbstring
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirror.vodien.com
  • epel: mirror.23media.de
  • extras: mirror.vodien.com
  • ius: mirrors.ircam.fr
  • updates: centos.shinjiru.com No package php7.0-mbstring available. Error: Nothing to do
1 Answer

On CentOS 7, PHP is still on version 5.4.16, though there are a number of community projects that provide more recent versions. In this case, we'll use the packages from the IUS Project.

To add their repository, run:

  • curl 'https://setup.ius.io/' -o setup-ius.sh
  • sudo bash setup-ius.sh

Now, you can install the packages with:

  • sudo yum install php70u-xml php70u-mbstring

You can find more details in:

PHP 7.0 was released on December 3, 2015. It promises substantial speed improvements over previous versions of the language, along with new features like scalar type hinting. This guide explains how to quickly upgrade a PHP 5.x installation on a CentOS 7 system with Apache or Nginx, using community-provided packages.
Have another answer? Share your knowledge.