简体   繁体   中英

Can not install php-mbstring on centOS

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM