intl extension installed but cant see in phpinfo() - php

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).

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?

CentOS 7: The mbstring extension is missing

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

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.

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.

Categories