How do I install PHP intl extension on CentOS?
Asked Answered
O

6

37

I know virtually nothing about installing packages. I managed to install Zend Framework 1 with yum a while back by following a very specific tutorial.

Now I need the PHP intl extension and I can't figure out how to install it.

I did

yum list php*intl

and saw that there was one available. So I did

yum install php-intl

and got the following error message:

Error: Package: php-intl-5.3.3-14.el6_3.x86_64 (updates)
       Requires: php-common = 5.3.3-14.el6_3
       Installed: php-common-5.3.17-2.el6.remi.x86_64 (@remi)
           php-common = 5.3.17-2.el6.remi
       Available: php-common-5.3.3-3.el6_2.8.x86_64 (base)
           php-common = 5.3.3-3.el6_2.8
       Available: php-common-5.3.3-14.el6_3.x86_64 (updates)
           php-common = 5.3.3-14.el6_3
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

I did not try the suggestions mentioned in the message because I didn't know what they would do and I am afraid of breaking something. This is a production machine and I don't have another machine to test on. I tried to find an rpm to download that was the same version as my PHP, but had no luck.

What do those two suggestions do and are they safe to try? What else can I try to get the intl extension installed?

Older answered 4/2, 2013 at 3:34 Comment(0)
P
44

As you have php-commom from remi repositories, you need to get php-intl from remi also.

Add --enable-repo option as follows:

yum --enablerepo=remi install php-intl
Platinumblond answered 7/2, 2014 at 0:44 Comment(3)
I'm unable to test this because remi is now PHP 5.4 and I'm not ready to upgrade yet. But the answer makes total sense and I assume it would have given desired result when remi was still PHP 5.3.x.Older
You're right, I got the same error message but I've PHP 5.4Pleurodynia
If you're using the "multiple versions" approach to the Remi repos, the command you want is yum install php56-php-intl (substitute in your selected version for 56).Glasses
B
11

If you have higher PHP version like 5.6, you have to enable both remi and remi-php56 repos to install all the additional dependencies:

yum --enablerepo=remi,remi-php56 install php-intl
Browder answered 6/7, 2015 at 9:29 Comment(1)
If you're using the "multiple versions" approach to the Remi repos, the command you want is yum install php56-php-intl (substitute in your selected version for 56).Glasses
R
2

I successfully installed INTL via pecl using following steps.

1) install icu & libs:

yum -y install icu libicu libicu-devel

2) php-devel package and phpize:

yum -y install php-devel phpize

3) and, of course gcc:

yum -y install gcc gcc-cpp gcc-c++

This is working for me.my php version is 5.6.12

Ruckus answered 8/9, 2015 at 10:48 Comment(2)
Don"t use the PECL extension which is deprecated and outdated as now merged in php-src. all providers of PHP packages have it. If you can install php-devel, you can also install php-intl from the same source.Bilberry
For centos 8 use dnf instead of yumSavanna
I
2

for php 7.0 using

#list all options    
$ sudo yum list php7*intl

#install
$ sudo yum install php70-intl
Isiahisiahi answered 2/4, 2019 at 20:43 Comment(0)
A
1

Yum is throwing an error because we are attempting to update multiple packages to versions that conflict. Your yum output says that php-intl requires a specific version of the php-common. Removing all the junk:

Requires 5.3.3-14
Installed 5.3.17-2
Available 1st Option: 5.3.3-3
Available 2nd Option: 5.3.3-14

This tells us that you already have installed a more recent version of php-common (5.3.17-2) than is allowed by php-intl.

I think you have two options. (As a newbie myself, I would not attempt these without practicing in a dev environment.)

1) Remove remi Packages

Quoting from a similar question on Super User. "Try removing all remi php packages, disable remi repository and install the default centos 6 php 5.3.3 packages."

https://superuser.com/questions/505340/centos-6-how-to-install-php-mysql-when-php-common-remi-is-present

2) Downgrade php-common to Version 5.3.3-14

yum downgrade php-common

I have no idea if you would run into more dependency issues and have to downgrade other packages. I found more details here.

https://www.centos.org/modules/newbb/viewtopic.php?topic_id=40567&forum=56

Other Stack Exchange sites show similar questions.

https://serverfault.com/search?q=centos+error+package (370 results)

https://unix.stackexchange.com/search?q=centos+error+package (57 results)

Aureole answered 21/3, 2013 at 17:45 Comment(0)
N
0

To elaborate just a little on @Fernando Valler's answer.

On my Fedora 35 machine, I have multiple installs of php. To check how many, I use a tool by Symfony (I am not sure how to do otherwise so quickly):

 $ symfony local:php:list
 +---------+--------------------------+---------+ 
 | Version |        Directory         |   PHP   |    
 +---------+--------------------------+---------+ 
 | 7.4.30  | /opt/remi/php74/root/usr | bin/php | 
 | 8.0.22  | /usr                     | bin/php |  
 | 8.1.10  | /opt/remi/php81/root/usr | bin/php |  
 +---------+--------------------------+---------+ 

Say I miss intl for version 8.1.10. First check whether intl.so is indeed not within its modules directory: php81 -r "echo ini_get('extension_dir');".

To install it, check packages by dnf list php*intl, you get something like:

$sudo dnf list php*intl
Installed Packages
php-intl.x86_64  8.0.22-1.fc35  @updates
Available Packages
php-intl.x86_64   8.0.23-1.fc35  updates 
php-symfony-intl.noarch  2.8.52-7.fc35  fedora  
php-symfony3-intl.noarch  3.4.49-2.fc35 fedora  
...
php72-php-intl.x86_64  7.2.34-11.fc35.remi  remi    
php81-php-intl.x86_64  8.1.10-1.fc35.remi  remi    
php82-php-intl.x86_64  8.2.0~rc2-15.fc35.remi  remi 

Select what you need, say for php8.1.10, and install intl extension for it: sudo dnf install php81-php-intl. It will pop up within the modules directory for php 8.1.

Niko answered 26/9, 2022 at 17:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.