intl extension is required
Hi,
I recetnly updated my application from laravel 10 to 11. After updating my composer files I started getting this error message on the filament admin panel:
The "intl" PHP extension is required to use the [format] method.
Why is this happening after the update? And how do I solve this? I ran composer require ext-intl
, but I'm still getting the error.
I run my local development environment on docker from wsl. Do I have to include intl in my docker image?38 Replies
Composer won't fix a php extension for you.....
Drop wsl and use Herd.
Else install the php intl extension on your wsl instance.
I installed the intl package in my container and I'm still getting the same error
sorry, didn't see you there
of course intl is installed on wsl
Is it enabled?
Then you need to include it in your php.ini
Yes, it is enabled
How do I include it?
What else can I check?
LetMeGoogleThat.com
How To Include Intl In Php
For those who think it's easier to annoy you than to Google 'How to include intl in php' themselves.
thanks, very professional
didn't even work...
also doesn't have a single instance of "include" on the 1st SERP, which is why I asked
This package has been required in Filament since 2022. https://github.com/filamentphp/filament/commit/140b1faa543ffcc7dfca6d0f4f6ad952902f0955
The question you are asking is of the infrastructure / setup and is included in all pre-built development enviroments and majority of web servers.
You may have to install intl for a specific php version. As shown in some of the answers from this SO page.
https://stackoverflow.com/questions/42243461/how-to-install-php-intl-extension-in-ubuntu-14-04
I am running WSL, but specifically a ubuntu app so this worked for me when I had intl issues.
Stack Overflow
How to install PHP intl extension in Ubuntu 14.04
I have a hard time to find exact method to install PHP intl extension in Ubuntu 14.04.
I tried with sudo apt-get install php5-intl but displays error Unable to locate package.
I really need this
Thanks! I went back through my command history and installed packages and I have installed intl for php 8.3.
php8.3-intl/jammy,now 8.3.7-1+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
Going back to your prior comment: Doesn't the link just show that ext-intl
is required and thus, will be installed, when I run composer install? Or what am I missing?
Either way, is there a way of knowing where my admin panel is looking for the intl module (wsl, vendor or docker container)? Because I feel like I've installed it in all possible locations now and it would really help to know what it doesn't likeNo because php extensions cannot be installed properly via composer it’s just a requirement
Thanks for clarifying.
It’s in PHP it’s a PHP runtime extension.
If you have multiple versions of php on your system it may be trying to run using a different php version. You may need to do something like this:
Here's another SO link: https://magento.stackexchange.com/questions/272815/how-to-switch-between-php-versions-on-ubuntu-nginx
that also has switching with nginx in case you need that.
Magento Stack Exchange
How to switch between PHP versions on Ubuntu Nginx
I have PHP 7.0 and 7.2 installed.
For now, I use PHP 7.0.
How can I switch to PHP 7.2?
Yes, I saw that it was still defaulting to php 8.1.2, (edit: I noticed that yesterday, which is when I ran update alternatives) so I ran
update-alternatives --config php
, now if I run php -v
I get:
The warning only appears when I have the intl extension enabled in the php.ini
Is there anything else I can try?Sounds like intl is trying to get loaded in twice, I'll admit this is an area where I'm a bit foggy in as I normally deal with these when I'm debugging my own issues and then forget about it until the next time I'm setting up an environment.
So try just disabling intl in your php.ini, and see if it works?
It does not
I feel that exact same way. My previous installation was working fine, I'm only dealing with this, because I updated to laravel 11 and had to go to php 8.3.
The intl warning has me puzzled as well. Whenever I look related issues up online, I find that you're supposed to uncomment it in the .ini. However, when I do, I get the warning
hmm..
https://stackoverflow.com/questions/32764981/php-warning-module-already-loaded-in-unknown-on-line-0
This thread is suggesting a duplicate xdebug.
Its possible that you have another package that is being duplicated? I don't think I've seen this one in my experiences.
Stack Overflow
PHP Warning: Module already loaded in Unknown on line 0
On Mac OSX Mavericks using homebrew php55 whenever I run a a php command I get the following error message (everything runs fine it's just annoying)
PHP Warning: Module 'intl' already loaded in U...
I'm not too concerned as this is just a warning and everything still works as it should. makes me wonder if there's no
ifndef
in php...Ah! I thought it was a blocking error.
So to recap:
in wsl I have php8.3 and php8.3-intl as evidenced by composer working
on docker I am using php 8.3 and even installed intl.
None of this was necessary before updating
And here's my dockerfile:
before that it was only:
And it worked just fine
And what is the error you're currently experiencing at this point?
When I go the admin panel I get a runtime exception:
The "intl" PHP extension is required to use the [format] method.
This is because of some calculated columns in a table widget. If I delete them the error goes away.
(I want them, though)have you restarted your webserver since installing intl?
sudo service apache2 restart
sudo systemctl restart nginx
I have restarted apache
For nginx it tells me servcie not found
oh ffs
I ran php -v in my container and realized it was still running the old container
it derived it from the existing php8.2 image
goddammit
anyway
deleted all the images, re-built and it works now
Glad to hear you got it working!
Thanks!
It would be great to understand better, because it seems I do have to explicitly install intl in the container, whereas before I didn't have to
Also, how tf does something like this even happen? I just assumed if I change the image, docker will see the difference and rebuild. I saw the added scripts running through...
Strange one
Thanks for your persistence and patience @Adam T
Did you restart the container after installing the extension?
yes
I even deleted the containers and some images
somehow I forgot a few in my confusion I guess
You keep saying this, like it comes at zero integration pain and as if my choice of wsl + docker is not valid.
Your choice is valid if you know how to run WSL and Docker, you are struggling too.
Herd you install, and put the app in the folder and it runs, there is a lot less pain.
I just did that and, no it doesn't just run
What doesn't just run about it? Did you set the right php version?
Oh, so there is something to set up?
Each site takes about 15 seconds to load
This is the reason I moved away from my previous XAMPP setup. I couldn't figure that out either...
Xampp is complicated, Herd isn't:
https://herd.laravel.com/docs/windows/1/advanced-usage/php-versions
Laravel Herd
Manage PHP versions
Herd should also be faster than WSL becasue is has the binaries
Only thing you need to do in the free version is install mysql, but you likely have already done that.
OK