How to install PHP mbstring on CentOS 6.2

PhpLinuxCentosMbstring

Php Problem Overview


How do I install mbstring with PHP on CentOS 6.2

I've tried:

$ sudo yum install php-mbstring

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.net.cen.ct.gov
 * extras: centos.aol.com
 * updates: mirrors.seas.harvard.edu
Setting up Install Process
No package php-mbstring available.
Error: Nothing to do

But no packages were found?

Php Solutions


Solution 1 - Php

do the following:

sudo nano /etc/yum.repos.d/CentOS-Base.repo

under the section updates, comment out the mirrorlist line (put a # in front of the line), then on a new line write:

baseurl=http://centos.intergenia.de/$releasever/updates/$basearch/

now try:

yum install php-mbstring

(afterwards you'll probably want to uncomment the mirrorlist and comment out the baseurl)

Solution 2 - Php

If you have cPanel hosting you can use Easy Apache to do this through shell. These are the steps.

  1. Type the Easy Apache PathType the path for Easy Apache
    > root@vps#### [~]# /scripts/easyapache
  2. Do not say yes to the "cPanel update available".
  3. Continue through the screens with defaults till you get to the "Exhaustive options list".
  4. Page down till you see the Mbstring extension listed and select it.
  5. Continue through the Steps and Save the Apache PHP build.

Apache and PHP will now rebuild to include the mbstring extension. Wait for the process to finish ~10 to 30 minutes. Once the process is finished you should see the Mbstring extension in the phpinfo now.

For more detailed steps see the article Installing the mbstring extension with Easy Apache

Solution 3 - Php

Please check your /etc/yum.conf file, maybe it is exclude php packages.

You should remove php* from this line so you can download php-* packages:

exclude= courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* php*

It's seems your server having some scripts like cPanel

Solution 4 - Php

*Make sure you update your linux box first

yum update

In case someone still has this problem, this is a valid solution:

> centos-release : rpm -q centos-release

Centos 6.*

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm

Centos 5.*

wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm

Then just do this to update:

yum --enablerepo=remi upgrade php-mbstring

Or this to install:

yum --enablerepo=remi install php-mbstring

Solution 5 - Php

  1. Find out php version - php -v
  2. Search for php extensions available - yum search php-
  3. Install using - yum install ea-php56-php-mbstring.x86_64
  4. Then httpd -k restart

> Package name - ea-php-php-mbstring.x86_64

Solution 6 - Php

yum install php-mbstring (as per http://php.net/manual/en/mbstring.installation.php)

I think you have to install the EPEL repository http://fedoraproject.org/wiki/EPEL

Solution 7 - Php

As yum install php-mbstring then httpd -k restart didn't do it for me, I think these options should be compiled, as documented here:

> Now, configure and build PHP. This is where you customize PHP with > various options, like which extensions will be enabled. Run > ./configure --help for a list of available options. In our example > we'll do a simple configure with Apache 2 and MySQL support. > > If you built Apache from source, as described above, the below example > will match your path for apxs, but if you installed Apache some other > way, you'll need to adjust the path to apxs accordingly. Note that > some distros may rename apxs to apxs2. > > cd ../php-NN > ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-mbstring > make > make install > > If you decide to change your configure options after installation, > you'll need to re-run the configure, make, and make install steps. You > only need to restart apache for the new module to take effect. A > recompile of Apache is not needed. > > Note that unless told otherwise, 'make install' will also install > PEAR, various PHP tools such as phpize, install the PHP CLI, and more.

Though this page says it's optional:

> --enable-mbstring > Allows multibyte character string support. This is optional, as slower custom code will be used if not available.

Solution 8 - Php

I have experienced the same issue before. In my case, I needed to install php-mbstring extension on GoDaddy VPS server. None of above solutions did work for me.

What I've found is to install PHP extensions using WHM (Web Hosting Manager) of GoDaddy. Anyone who use GoDaddy VPS server can access this page with the following address. >http://{Your_Server_IP_Address}:2087

On this page, you can easily find Easy Apache software that can help you to install/upgrade php components and extensions. You can select currently installed profile and customize and then provision the profile. Everything with Easy Apache is explanatory.

I remember that I did very similar things for HostGator server, but I don't remember how actually I did for profile update.

Edit: When you have got the server which supports Web Hosting Manager, then you can add/update/remove php extensions on WHM. On godaddy servers, it's even recommended to update PHP ini settings on WHM.

Solution 9 - Php

None of above works for godaddy server centOS 6, apache 2.4, php 5.6

Instead, you should

Install the mbstring PHP Extension with EasyApache

check if you already have it by, putty or ssh

php -m | grep mbstring

[if nothing, means missing mbstring]

Now you need to goto godaddy your account page,

click manager server,

open whm ----- search for apache,

open "easy apache 4"(my case)

Now you need customize currently installed packages,

by

click "customize" button on top line next to "currently installed package..."

search mbstring,

click on/off toggle next to it.

click next, next, .... privision..done.

Now you should have mbstring

by check again at putty(ssh)

php -m | grep mbstring [should see mbstring]

or you can find mbstring at phpinfo() page

Solution 10 - Php

sudo yum install php<version>w-mbstring

ex. sudo yum install php56w-mbstring

Solution 11 - Php

If none of the above help you out, and you have the option, try obtaining one of the rpm files eg:

wget http://rpms.famillecollet.com/enterprise/6/remi/x86_64/php-mbstring-5.4.45-2.el6.remi.x86_64.rpm

then using rpm, install it ignoring the depenecies like so:

rpm -i --nodeps php-mbstring-5.4.45-2.el6.remi.x86_64.rpm

Hope that helps out.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionalioygurView Question on Stackoverflow
Solution 1 - PhpTor PView Answer on Stackoverflow
Solution 2 - Phpuser1934863View Answer on Stackoverflow
Solution 3 - PhpSaud AlfadhliView Answer on Stackoverflow
Solution 4 - PhpAndres SKView Answer on Stackoverflow
Solution 5 - PhpSarvesh AcharyaView Answer on Stackoverflow
Solution 6 - PhpTor PView Answer on Stackoverflow
Solution 7 - PhpCees TimmermanView Answer on Stackoverflow
Solution 8 - PhpDoctigerView Answer on Stackoverflow
Solution 9 - PhphoogwView Answer on Stackoverflow
Solution 10 - PhpPrabu KaranaView Answer on Stackoverflow
Solution 11 - PhpBren1818View Answer on Stackoverflow