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
?
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