Question

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

Posted February 3, 2018 15.5k views
CentOSPHPPHP Frameworks

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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

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:

by Brennen Bearnes
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.

Worked for me. I had to use php72u, though as I am on 7.2. Thanks!

Submit an Answer