4

I had php 5.4 on centOs and I have removed that and installed php 7. Now One of my codes on server return the following error:

PHP Fatal error: Call to undefined function mb_internal_encoding()

And when I run yum install php-mbstring I got the following error:

Error: php70u-common conflicts with php-common-5.4.16-43.el7_4.x86_64

Error: php70u-json conflicts with php-common-5.4.16-43.el7_4.x86_64

I have removed and installed php7 several times but I didn't work. It seems that centOs want to install an older version of the package but I don't know how to tell it to download the latest version of mbstring

Community
  • 1
  • 1
Leo
  • 867
  • 1
  • 15
  • 41
  • You can probably ask `yum` to locate possible PHP 7 packages (hint: They seem to have a common prefix in their name). Due to the major version upgrade, you can't expect the package name to remain the same, but maybe something will fit. That said, PHP 7.1 is out, so I'd skip 7.0. – Ulrich Eckhardt Jan 07 '18 at 12:54
  • How can I ask yum to do that, Can you explain that? – Leo Jan 07 '18 at 12:56
  • How about you read the manual for yum first and then ask questions if anything is not clear? – Ulrich Eckhardt Jan 07 '18 at 12:58
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Web Applications Stack Exchange](http://webapps.stackexchange.com/), [Webmaster Stack Exchange](http://webmasters.stackexchange.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Jan 07 '18 at 13:01

2 Answers2

6

To search the right MB-String for your PHP version try this command:

sudo yum list | egrep 'php' | grep 70

Change (70) by the specific version of PHP you do have installed in your server,this command will show you all the packages related to you PHP version.
This command will show :

ea-php70-php-mbstring.i686                   
ea-php70-php-mbstring.x86_64

Now you can install the version compatible with your system.I hope it will works for you.

1

yum install php72w-mbstring

will install the mbstring for 7.2

cannot-initialize-mbstring-with-php-7


If that does not work, you might only have package for 7.1 available


If that still does not work, you could remove the old 5.4 php common package and try again :

First search which old php packages are still installed on your machine :

yum list installed | grep php | grep 5.4

Then remove the old packages (for instance php-commom-5.4 . You can do the same with other ones if not used)

yum remove php-common-5.4

Then install php-mbstring again

yum install php-mbstring
Cedric
  • 5,135
  • 11
  • 42
  • 61