CentOS 7: The mbstring extension is missing - php

I've installed phpmyadmin (4.5.3.1) on CentOS 07 with apache server (httpd-2.4.18) and PHP 7.0.1. I get the error:
The mbstring extension is missing. Please check your PHP configuration.
So I searched the internet for this error and people came with the following solution, which I tried:
Installing the php-mbstring and php-mcrypt extensions:
yum install php-mbstring php-mcrypt php-gd
this command returns:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.vn
* epel: ftp.cuhk.edu.hk
* extras: mirrors.viethosting.vn
* updates: mirrors.viethosting.vn
Package php-mbstring-5.4.16-36.el7_1.x86_64 already installed and latest version
Package php-mcrypt-5.4.16-3.el7.x86_64 already installed and latest version
Package php-gd-5.4.16-36.el7_1.x86_64 already installed and latest version
Nothing to do
Please help me!

I was wondering for like 2 hours for this issue and the only thing I missed was restarting php-fpm along with httpd.
So this freaking line solved my headache:
systemctl restart php-fpm

You need to check your php.ini and make sure it is loading the mbstring extension, or load it at runtime:
Here for the ini extension loading:
How do I configure php to enable pdo and include mysqli on CentOS?
Here for runtime loading
http://php.net/manual/en/function.dl.php

Related

CentOS cyberpanel PHP 8.0 zip extension

I'm a moodle user and recently found out that everytime i try to download a ODS file (exporting grades) it says Exception - Class "ZipArchive" not found"
it turns out that my php (version 8.0) doesn't have the zip extension installed
i tried installing the zip extension on cyberpanel(my moodle is hosted on cyberpanel CentOS 7) but i don't seems to install, when i click to install i receive this message:
Loaded plugins: copr, fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: atl.mirrors.clouvider.net
* epel: mirrors.coreix.net
* extras: mirror.dal.nexril.net
* updates: atl.mirrors.clouvider.net
10 packages excluded due to repository priority protections
Package lsphp80-common-8.0.15-1.el7.x86_64 already installed and latest version
Nothing to do
PHP Extension Installed.
but then when i return to the extension page it says that the extension is not installed, and i still can't generate ODS files, i tried searching in about it and people said that i need to do it on terminal, i tried using cyberpanel terminal as root user with those commands:
yum install php-pear
yum install php-devel
pecl install zip
then i gone to the php.ini ( i tried open it on either cyberpanel interface and on terminal) and insert the code:
extension=zip.so;
before the "module settings" section on the file, and it still doesn't work(it sems that i have multiple versions of php installed on my cyberpanel, i tried editing php.ini on my php 8.0 directory and other versions avaliable)
its weird because on version 7.3 of php it install and work normally(it even install on the interface) and when i change the php version on my moodle to 7.3(i don't wanna use this version) it the error completely disappears, how can i solve it?

intl extension installed but cant see in phpinfo()

I am using centos 7 with lamp +webmin control panel php 7.2,I need intl intl extension,I followed few tutorials from google and intl extension is installed(I am sure because if I try to install again it says already installed latest updated )see bellow snnipest
[root#xxxxxxx ~]# sudo yum --enablerepo=remi install php-intl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* Webmin: download.webmin.com
* base: ftp.hosteurope.de
Excluding mirror: mirror.fra10.de.leaseweb.net
* centos-sclo-rh: mirror.alpix.eu
* centos-sclo-sclo: mirror.checkdomain.de
Excluding mirror: mirror.de.leaseweb.net
Excluding mirror: mirror.nl.leaseweb.net
* epel: ftp-stud.hs-esslingen.de
* extras: centos.mirror.iphh.net
* remi: remi.mirror.liteserver.nl
* remi-php56: remi.mirror.liteserver.nl
* remi-php72: remi.mirror.liteserver.nl
* remi-safe: remi.mirror.liteserver.nl
* updates: ftp.hosteurope.de
Package php-intl-7.2.27-1.el7.remi.x86_64 already installed and latest version
Nothing to do
Already added extension=php_intl or extension=intl in both php.ini
Configuration File (php.ini) Path /etc/opt/rh/rh-php72
Loaded Configuration File /home/two4cloudspace/etc/php7.2/php.
and then restarted,but still I cant find intl extension in phpinfo() output
in my phpinfo() output showing my module directory is
/opt/rh/rh-php72/root/usr/lib64/php/modules
but php -r "echo ini_get('extension_dir');" showing my module directory is
/usr/lib64/php/modules
and I tried to find intl.so file in both directory and I found the file in
/usr/lib64/php/modules
but cant find in
/opt/rh/rh-php72/root/usr/lib64/php/modules
and then I downloaded the intl.so and uploaded to /opt/rh/rh-php72/root/usr/lib64/php/modules and restarted but still same issue.
if I command php -m I can see all modules and intl is included there.
but I cant find it in phpinfo() or where need to intl extension there it says intl missing
what am I doing wrong or how do I solve it?
You are mixing up different RPM packages providing PHP (run rpm -qa | grep php | sort and rpm -qf $(which php), it will reveal before mentioned). The directory /opt/rh/rh-php72/root/usr/lib64/php/modules belongs to rh-php72-php and not to Remi. Thus sudo yum install --enablerepo=centos-sclo-rh rh-php72-php-intl helps if you need /opt/rh/rh-php72/root/usr/lib64/php/modules/intl.so; don't forget to restart your webserver afterwards (if you don't use php-fpm rather mod_php).

No package mod_fastcgi available on centos 6.8

I'm newbie, I'm trying to install php mod fastcgi for apache 2.2 on centos 6.8, but I got error with message: "No package mod_fastcgi available. Nothing to do".
Please help me, thank so much.
[root#host15 ~]# yum install -y mod_fastcgi
Loaded plugins: fastestmirror, priorities
Setting up Install Process
Loading mirror speeds from cached hostfile
base: mirror.digistar.vn
epel: mirrors.digipower.vn
extras: mirror.digistar.vn
remi: mirror.upb.edu.co
remi-php56: mirror.upb.edu.co
remi-safe: mirror.upb.edu.co
updates: mirrors.viethosting.com
2347 packages excluded due to repository priority protections
No package mod_fastcgi available.
Error: Nothing to do
This mod_fastcgi extension is dead for years, and not available in the repositories.
You can use, instead
mod_fcgid, see its documentation and package information
mod_proxy_fcgi, see its documentation and package information
The second one is a backport from httpd 2.4 to 2.2 of the default fastcgi implementation. To use it, see the ProxyPass directive.

I can't install any package related to PHP with yum

I can't install any package related PHP, I get a yum error: No package php available.
My PHP version is 5.4.37 on Centos 7. I installed remi for other purposes and I think that the repository is not compatible with PHP version but I don't know how to fix it.
[root#server ~]# sudo yum install php php-pear
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centosmirror.netcup.net
* epel: mirrors.n-ix.net
* extras: centosmirror.netcup.net
* remi: mirror5.layerjet.com
* remi-safe: mirror5.layerjet.com
* updates: centosmirror.netcup.net
No package php available.
No package php-pear available.
Error: Nothing to do
You have, in yum configuration:
exclude=apache* httpd* mod_* mysql* MySQL* mariadb* da_* ftp exim* sendmail* php* bind-chroot*
This is very probably a "panel" enabled server (cpanel or others), which provides its own PHP stack.
So by design, you cannot install "php*" packages from standard repository or any other 3rd party repository. Such distribution is so altered, that it is often considered as "Not CentOS".
So, better to ask your php stack provider for how to update it (if possible, without breaking the panel application)
As suggested in other answer, this may be related to excludes set in yum.conf
The command below allows to run the installation of excluded packages without modifying the conf file:
yum --disableexcludes=main install php
BUT
It seems like it might be better to re-install PHP by the means of the control panel installed. IE Cpanel - EasyApache..

Installing php-ldap on CentOs

I have an unmanaged VPS server preinstalled with CentOs 6.6 and WHM/CPanel. I am trying to install php-ldap but it just says package not found. I have not been able to find anywhere what repository it should be in. How can I install ldap on my server to work with php 5.4? I am trying to manage Windows Server 2012 R2 Active Directory.
root#vps [~]# yum install php-ldap
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.5ninesolutions.com
* epel: fedora-epel.mirror.lstn.net
* extras: centos.arvixe.com
* updates: pubmirrors.dal.corespace.com
No package php-ldap available.
Error: Nothing to do
root#vps [~]#
On a cpanel serveur you probably have an "exclude" line in yum.conf (see I can't install any package related to PHP with yum) which prevent you to install/upgrade php from another repository.
To see the provider of "php", user this command
rpm -qf $(which php)
And the ldap extension, if available will be in the same namespace.
Notice switch the php stack from the cpanel provider to another repo can break it.
You need to understand that the base repos typically don't contain boutique builds for PHP. Your best bet is to install a different repo, like the Remi repo, which does contain that RPM.
While I'm at it, PHP 5.4 went End-of-life 4 days ago. Remi offers 5.5 and 5.6 so you should consider upgrading
Get the php version you are running by
php -v
if not worked try
rpm -qa |grep php
if the php version is 5.4 then use
sudo yum install php54w-ldap
if 5.6
sudo yum install php56w-ldap
and so on.

Categories