F
Filament7mo ago
jak888

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
toeknee
toeknee7mo ago
Composer won't fix a php extension for you..... Drop wsl and use Herd. Else install the php intl extension on your wsl instance.
jak888
jak888OP7mo ago
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
Dennis Koch
Dennis Koch7mo ago
Is it enabled?
toeknee
toeknee7mo ago
Then you need to include it in your php.ini
jak888
jak888OP7mo ago
Yes, it is enabled How do I include it? What else can I check?
toeknee
toeknee7mo ago
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.
jak888
jak888OP7mo ago
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
toeknee
toeknee7mo ago
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.
Adam T
Adam T7mo ago
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
jak888
jak888OP7mo ago
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 like
toeknee
toeknee7mo ago
No because php extensions cannot be installed properly via composer it’s just a requirement
jak888
jak888OP7mo ago
Thanks for clarifying.
toeknee
toeknee7mo ago
It’s in PHP it’s a PHP runtime extension.
Adam T
Adam T7mo ago
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:
sudo a2dismod php8.0
sudo a2enmod php8.3
sudo service apache2 restart
sudo a2dismod php8.0
sudo a2enmod php8.3
sudo service apache2 restart
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?
jak888
jak888OP7mo ago
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:
PHP Warning: Module "intl" is already loaded in Unknown on line 0
PHP 8.3.7 (cli) (built: May 13 2024 15:38:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.7, Copyright (c) Zend Technologies
with Zend OPcache v8.3.7, Copyright (c), by Zend Technologies
PHP Warning: Module "intl" is already loaded in Unknown on line 0
PHP 8.3.7 (cli) (built: May 13 2024 15:38:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.7, Copyright (c) Zend Technologies
with Zend OPcache v8.3.7, Copyright (c), by Zend Technologies
The warning only appears when I have the intl extension enabled in the php.ini Is there anything else I can try?
Adam T
Adam T7mo ago
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?
jak888
jak888OP7mo ago
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
Adam T
Adam T7mo ago
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...
jak888
jak888OP7mo ago
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...
Adam T
Adam T7mo ago
Ah! I thought it was a blocking error.
jak888
jak888OP7mo ago
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:
FROM php:8.3-fpm-alpine

RUN apk update && apk add \
icu-dev

RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
FROM php:8.3-fpm-alpine

RUN apk update && apk add \
icu-dev

RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
before that it was only:
FROM php:8.2-fpm-alpine

RUN docker-php-ext-install pdo pdo_mysql
FROM php:8.2-fpm-alpine

RUN docker-php-ext-install pdo pdo_mysql
And it worked just fine
Adam T
Adam T7mo ago
And what is the error you're currently experiencing at this point?
jak888
jak888OP7mo ago
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)
Adam T
Adam T7mo ago
have you restarted your webserver since installing intl? sudo service apache2 restart sudo systemctl restart nginx
jak888
jak888OP7mo ago
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
Adam T
Adam T7mo ago
Glad to hear you got it working!
jak888
jak888OP7mo ago
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
awcodes
awcodes7mo ago
Did you restart the container after installing the extension?
jak888
jak888OP7mo ago
yes I even deleted the containers and some images somehow I forgot a few in my confusion I guess
toeknee
toeknee7mo ago
Or just use: https://herd.laravel.com/windows and all your problems will be solved.
Laravel Herd
Laravel Herd
Laravel Development perfected - One click PHP development environment.
jak888
jak888OP7mo ago
You keep saying this, like it comes at zero integration pain and as if my choice of wsl + docker is not valid.
toeknee
toeknee7mo ago
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.
jak888
jak888OP7mo ago
I just did that and, no it doesn't just run
toeknee
toeknee7mo ago
What doesn't just run about it? Did you set the right php version?
jak888
jak888OP7mo ago
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...
toeknee
toeknee7mo ago
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.
jak888
jak888OP7mo ago
OK
Want results from more Discord servers?
Add your server