centOS 7 Can't install php-mbstring extension - php

i've tried to install the extension mbstring but i have the following error:
Error: Package: php-mbstring-5.4.16-23.el7_0.3.x86_64 (updates)
Requires: php-common(x86-64) = 5.4.16-23.el7_0.3
Installed: php-common-5.4.38-1.el7.remi.x86_64 (#remi)
php-common(x86-64) = 5.4.38-1.el7.remi
Available: php-common-5.4.16-21.el7.x86_64 (base)
php-common(x86-64) = 5.4.16-21.el7
Available: php-common-5.4.16-23.el7_0.x86_64 (updates)
php-common(x86-64) = 5.4.16-23.el7_0
Available: php-common-5.4.16-23.el7_0.1.x86_64 (updates)
php-common(x86-64) = 5.4.16-23.el7_0.1
Available: php-common-5.4.16-23.el7_0.3.x86_64 (updates)
php-common(x86-64) = 5.4.16-23.el7_0.3
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
What could i do to resolve the problem ?
Thanks for your help

For people who want to know how to solve this :
sudo yum remove php-common
Then you can:
sudo yum install php-mbstring
It will automaticcaly install dependecies (php-common)

This answer from AWS Amazon forum:
yum -y install yum-utils
yum repolist all
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
Then you can install php-mbstring, and maybe, I don't know exactly, but maybe it can help for servers on Amazon only.

need to search which mbstring version required you.
cat /etc/redhat-release && php -v && yum search mbstring
========================================================================= N/S matched: mbstring ==========================================================================
ea-php54-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php55-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php56-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php70-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php71-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php72-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php73-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
now you can check what you actually need like i am using php7.1 so my command will be
sudo yum install ea-php71-php-mbstring

The selected answer is liable to change the installed PHP version. When not using the stock CentOS PHP, yum will try to install the mbstring extension for the wrong version of PHP.
You can check your installed PHP version with php -v:
$ php -v
PHP 5.5.36 (cli) (built: May 28 2016 12:05:32)
Then go ahead and install the correct mbstring version for your installed PHP version:
$ sudo yum install php55w-mbstring

You must specify the same version as your php-common, mine is php70w-common
sudo yum install php70w-mbstring

Non of above works for godaddy dedicated 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

Non of above works for godaddy dedicated 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 go to godaddy your account page,
1.click manager server,
2.open whm ----- search for apache,
3.open "easy apache 4"(my case)
Now you need customize currently installed packages,by
4.click "customize" button on top line next to "currently installed package..."
5.In the search bar write "mbstring",
6.click on/off toggle next to it.
7.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
Thanks, my problem is done

Been searching for the answer for half day, then only realise cPanel / WHM version of CentOS will disable YUM to update php. You shall remove php* from exclude list in /etc/yum.conf.
....

Fedora 28 (Cloud Edition)
sudo yum install php56-php-mbstring
sudo yum install php70-php-mbstring
sudo yum install php71-php-mbstring
sudo yum install php72-php-mbstring
sudo yum install php73-php-mbstring

Related

extension=php_intl.dll in my linux centos doesn't exists

I have a problem, I just want to uncomment extension=php_intl.dll in my php.ini file
but that extension doesn't exist, I'm using Centos with Nginx configuration.
Linux servers don't use .dll files. You need a .so instead.
To install php_intl on CentOS , you should enable remi repo . Open the terminal and run the following commands:
wget https://rhel7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release*.rpm
Update your system then install the php-intl:
sudo yum update
sudo yum --enablerepo=remi install php-intl
To permanently enable remi repo , open the terminal and run the following command:
sudo nano /etc/yum.repos.d/remi.repo
Set enabled=1.
How did you install PHP ?
PHP 5.6.3 is terribly old, and affected by tons of security issues, latest version is 5.6.40 but have reached its end of life a few months ago
If installed from sources, you have to rebuild it, location of php command usually gives useful information (ex, when installed in /usr/local)
which php
or remove this build from sources, and switch to RPM provided binaries.
If installed from a 3rd party repository, you should find the intl extension in the same repository.
see information provided by the yum command
yum info php-cli
While I heartily recommends to upgrade to a supported version (7.1+), if you want to keep 5.6, "remi" is the only repository which still provides this version (with security backports).
To upgrade your installation (to latest 5.6.40 or any other version, 7.0, 7.1, 7.2, 7.3), simply follow the wizard instructions.
With RPM, you never have to change php.ini to enable installed extension, each package provides its own configuration file (ex: /etc/php.d/20-intl.ini) which
enable it.
With proper provider, for any needed extension (ex xxx), a simple
yum install php-xxx
will install the package with this extension (package name may be different, as some packages provide various extensions).

Installing PHP 5.4 on RHEL5, getting caught in dependency rabbit-hole

I tried using webstatic, epel and remi repo's and all fail with the following error:
Missing Dependency: openldap >= 2.3.43-25.el5_8.1 is
needed by package libcurl-7.27.0-10.el5.remi.x86_64 (remi-test)
Fine, OK, openldap version on my system is:
sudo yum list package openldap
Installed Packages
openldap.i386 2.3.43-3.el5 installed
openldap.x86_64 2.3.43-3.el5 installed
(What's sad is i'm only off by a patch release -3 to -25! grr!)
Let's install OPENLDAP 2.4 from rpm since it's not available on any of the repo's:
wget http://someurl/downloads/openldap-2.4.24.tgz
tar -zxf openldap-2.4.24.tgz
cd openldap-2.4.24
./configure
Get this error:
checking if Berkeley DB version supported by BDB/HDB backends... no
configure: error: BerkeleyDB version incompatible with BDB/HDB backends
I just want to upgrade PHP 5.1 to 5.4 on RedHat Linux 5 86_x64. It doesn't have to be this freakin' complicated! Anybody have any ideas?
Compiling php from source is a dependency nightmare! but I attempted it anyway:
sudo rpm -ivh php54-5.4.16-1.ius.el5.src.rpm
Password:
warning: php54-5.4.16-1.ius.el5.src.rpm: Header V4 DSA signature: NOKEY, key ID 9cd4953f
1:php54 warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root x8
warning: user mockbuild does not exist - using root x8
########################################### [100%]
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
...repeated 8 more times.
i apparantly finished 100% but there's no sign of it under sudo rpm -qa | grep *php* returns zero results. (FYI: I have already 'yum removed' php 5.1 already)
Thanks for any help
I finally got this working through brute force. I downloaded all the RPMS for php I needed (cli,devel,common,pdo,mysql,xml,ldap).
I compiled openldap 2.3.5 from source and yum installed 'libedit' (one of the php rpms needed it
Then i ran rpm -ivh on each of the php rpm's. Some depended on each other so there's definitely an order to do them in (example pdo must go before mysql), but by trial and error PHP 5.4 is successfully installed.
Something that should have been as simple as
sudo rpm -ivh http://some.complete.repo/
sudo yum install php php-common php-cli php-devel php-xml php-pdo php-mysql php-ldap
But welcome to the world of Linux :P. (And one wonders how Microsoft did well over all these years with their crappy OS)
/end_rant
It's much easier to install epel and remi repositories and then do a yum install:
http://kb.parallels.com/en/115833

Cannot Install any PHP PECL through Cpanel (WHM) or SSH

When I try to install a module through PHP PECL through cpanel or whm (CENTOS 6.3 x86_64 / WHM 11.34.0 (build 7) ) I always get this result:
ERROR: `/root/tmp/pear/imagick/configure --with-imagick' failed The
Imagick.so object is not in
/usr/local/lib/php/extensions/no-debug-non-zts-20090626
Here in another example with html_parse:
ERROR: `/root/tmp/pear/html_parse/configure --with-ekhtml' failed The
html_parse.so object is not in
/usr/local/lib/php/extensions/no-debug-non-zts-20090626
I have googled it, done the suggestions and always the same result.
What library are you trying to install?
I've found mixed results using pecl on Redhat, centos, or fedora machinces if I've ever used yum to install their versions of PHP libs. The easiest way around your issue would be to look to see if it's in the Yum repo and install it that way:
yum search 'modulename'
yum install 'packagename'
I usually just do a yum search php and scan down the list of modules.
If you want to use pecl or can't because the libraries aren't part of yum, I'd remove the natively included version and build your PHP from scratch. You can remove PHP and related libraries installed with the distro via yum as well.
I have a similar server setup and I needed pecl_http. Instead of using WHM (Home »
Software » Module Installers) I used command line. Simply typed: pecl install pecl_http
It should be the same for other modules like the html_parse, just change the module name, like: pecl install html_parse
Figured I'd add this for anyone else looking for this info.

How to install PHP mbstring on CentOS 6.2

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?
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)
If you have cPanel hosting you can use Easy Apache to do this through shell. These are the steps.
Type the Easy Apache PathType the path for Easy Apache
root#vps#### [~]# /scripts/easyapache
Do not say yes to the "cPanel update available".
Continue through the screens with defaults till you get to the "Exhaustive options list".
Page down till you see the Mbstring extension listed and select it.
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
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
*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
Find out php version - php -v
Search for php extensions available - yum search php-
Install using - yum install ea-php56-php-mbstring.x86_64
Then httpd -k restart
Package name - ea-php-php-mbstring.x86_64
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
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
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.
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.
sudo yum install php<version>w-mbstring
ex.
sudo yum install php56w-mbstring
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.

Running PHP 5.3 on CentOS 5.4 - fatal error Class 'PDO' not found

What is the best way to get PHP 5.3 up and running on CentOS 5.4.
My machine says I have PHP 5.3 installed but running into an issue with my script that says
Fatal error: Class 'PDO' not found in /var/www/html/lib/rb.php on line 45
It fails trying to new up a PDO class in the RedbeanPHP 3.0 lib.
How can I fix this missing PDO problem?
I tried to follow these instructions:
from http://www.computingunplugged.com/issues/issue201102/00002619002
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# THIS LINE FAILED FOR ME
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-6.ius.el5.noarch.rpm
yum erase php php-pear php-mysql php-cli php-common
yum install php53u php53u-pear php53u-cli php53u-common php53u-gd
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap
yum install php53u-xml php53u-xmlrpc php53u-bcmath
UPDATE
Someone removed their answer. It was good. I'm putting it back in with exact steps.
First I had to yum install php53u-devel
To quote "
You need the PDO extension. Usually the best way to install extensions is via PECL.
Before you can install any PECL extensions you need to install the php5-dev package
sudo pecl install pdo
sudo pecl install pdo_mysql
You then need add the following to the end of your php.ini file(s). Depending on which version of PHP you installed they’ll be /etc/php5/apache2/php.ini, /etc/php5/cgi/php.ini and /etc/php/cli/php.ini.
extension=pdo.so
extension=pdo_mysql.so
"
Now I get a mysql_query_missing when trying to run sudo pecl install pdo_mysql
and not sure how to get past this.
You'll have to install the php-pdo package as well.
Edit: Maybe this helps as well: How do I enable PDO using CentOS?
I have been successfully able to install PHP-5.3 on CentOS 5.4 Linux. I needed this to be able to successfully install and run Drupal 7 - which also worked out for me. Here are the details:
This is a copy of the answer I wrote up in ServerFault: https://serverfault.com/a/392168/29205
(...for my question: https://serverfault.com/questions/391772/php-xml-install-complains-of-dependency-php-common-but-this-is-already-installed/392168#392168 )
The solution is based on the accepted answer in:
https://serverfault.com/questions/391839/how-to-force-centos-yum-to-use-a-later-version-of-a-package-dependency-already-i
In summary: move to php5.3.
Reason: support for php5.2 as been removed owing to security issues as explained in that other question's accepted answer. This removal causes mismatch of the versions of the dependencies and therefore the error seen.
Background
I wanted to run Drupal 7 on a CentOS 5.4 machine. So I needed 5.3 version of PHP.
Here are the full working steps to upgrade to PHP 5.3 with working repositories as of May 24 2012 ( I provide comments preceded by # - you don't need these, just for your info)
# Comment: sites like http://www.computingunplugged.com/issues/issue201102/00002619001
# provide a good start for remedying the problem whereby we need 5.3 on CentOS 5.4 to run Drupal 7. But although their packages worked at the time, the links are now outdated, and updates to these are below.
# comment: (as of May 2012 - the following work, the reason for failures was use of 1) older packages no longer on the server and 2) change of address of one of the servers to dl.fedoraproject.org/pub/epel (credit to: http://osdir.com/ml/centos/2012-03/msg00057.html )
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm
yum erase php php-pear php-mysql php-cli php-common
yum install php53u php53u-pear php53u-cli php53u-common php53u-gd
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap
yum install php53u-xml php53u-xmlrpc php53u-bcmath
# After doing the above, php -v shows 5.3.x But on attempting to install Drupal 7 you may get complaint of something "Your PHP installation is too old 5.1.6 Drupal requires at least PHP 5.2.4. See the system requirements page for more information." and php.info shows the same
# The remedy is to simply restart your apache server
service httpd restart
# credit to following for suggesting service httpd restart :-
# https://serverfault.com/a/207806/29205
# https://serverfault.com/questions/207762/centos-updating-php-via-yum-doesnt-change-the-version-apache-uses
# Drupal 7 install on CentOS 5.4 worked after applying the above steps
# If your MySQL server is not running (check by ps -ef | grep mysql ) then you can run:
/etc/init.d/mysqld
# ...to start it, and to make sure it starts when the machine is restarted or cold booted:
chkconfig mysqld on

Categories