PHP7.2 missing intl extension
Asked Answered
D

1

7

I'm trying to run php app that use locale_accept_from_http function from intl extension. My php version is 7.2 and I get an error: Call to undefined function locale_accept_from_http();

I was trying:

1. Install extension sudo apt-get install php-intl. The error is:

Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: php-intl : Depends: php7.1-intl but it is not going to be installed E: Unable to correct problems, you have held broken packages.

2. Enable intl extension in php.ini. I'm getting a warning:

PHP Warning: PHP Startup: Unable to load dynamic library 'intl'

What is the right way to use this extension with php7.2?

Decor answered 25/12, 2018 at 11:35 Comment(2)
Was PHP installed via apt too? What error do you get from apt-get install -f php7.2-intl?Byroad
@JonStirling php is installed via apt. I get Unable to locate package php7.2-intlDecor
S
15

As it states in your error, you are having broken packages so in that case, you should try to fix it, probably following commands will fix them.

apt update
apt autoremove

Once you have fixed that issue, you can try executing following commands if you have not added ondrej PPA:

add-apt-repository -y ppa:ondrej/php
apt install php7.2 php7.2-intl
Seftton answered 25/12, 2018 at 16:7 Comment(3)
This worked for me for php7.4 ubuntu 20.04.Lenticular
is it safe to say apt install php7.2 when php 72 is already installed (production server). I have installed php7.2-intl alone but there is no intl.so module available to loadThinia
Worked for me with PHP 7.3, executing apt install php7.3-intl was enough.Deme

© 2022 - 2024 — McMap. All rights reserved.