Re: Issue with MediaWiki Installation: IntlException and Locale Problems in Apache
- Reply: ابو بندر العصيمي : "Re: Issue with MediaWiki Installation: IntlException and Locale Problems in Apache"
- Reply: Adrian Gschwend : "Re: Issue with MediaWiki Installation: IntlException and Locale Problems in Apache"
- In reply to: Adrian Gschwend : "Issue with MediaWiki Installation: IntlException and Locale Problems in Apache"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 Sep 2024 19:26:52 UTC
> On Sep 30, 2024, at 1:39 PM, Adrian Gschwend <ml-ktk@netlabs.org> wrote: > > Hi group, > > I'm trying to install MediaWiki on FreeBSD with Apache and PHP 8.1 via mod_php, but I keep running into an issue related to the `Intl` extension and locale settings. During the MediaWiki installation process, I get the following error: > > ``` > IntlException: Constructor failed > ``` > > There are no errors in the Apache log, and I have doublechecked that the `Intl` extension is enabled and working in CLI PHP. When I run the same code via Apache, it throws an exception. > > I created a minimal PHP test case to see if I could reproduce the error outside of MediaWiki. Here's the test script: > > ``` > <?php > > // Set the locale to test > $locale = 'en_US.UTF-8'; > > // Check if Intl extension is loaded > if (!extension_loaded('intl')) { > die("Intl extension is not loaded!\n"); > } > > // Display the current locale settings > echo "Current locale: " . setlocale(LC_ALL, 0) . "\n"; > > // Test the Intl NumberFormatter > try { > $formatter = new NumberFormatter($locale, NumberFormatter::DECIMAL); > echo "Number formatting test: " . $formatter->format(12345.67) . "\n"; > } catch (Exception $e) { > echo "IntlException: " . $e->getMessage() . "\n"; > } > ?> > > ``` > > Results: > > - Command Line PHP: > > ``` > Current locale: C/C.UTF-8/C/C/C/C > Number formatting test: 12,345.67 > ``` > > - Apache (via browser): > > ``` > Current locale: C/C.UTF-8/C/C/C/C > IntlException: Constructor failed > ``` > > So the same script works on the same jail on cli but not in Apache with mod_php. > > What I've Tried > > - I have set `LANG` and `LC_ALL` to `en_US.UTF-8` in both the Apache environment and PHP’s `php.ini`. > - I verified that the `Intl` extension is loaded in both CLI and Apache environments. > - `phpinfo()` reports the correct locale in Apache (`en_US.UTF-8`), but the error persists. > > I'm really running out of ideas here, I run MediaWiki for years and while it's a new jail to upgrade my env, this is not something I've seen before. > > Note that I tried the same with PHP 8.2, same error. > > Any suggestions on how to resolve this would be greatly appreciated. > > thanks & regards > > Adrian > I have been running Mediawiki on FreeBSD for about ten years. I’ve never seen this issue. How did you install apache, php and Mediawiki? Which version of Mediawiki? Did you use pkg for all of them? If so, all needed parts of php should be there and working. Have you done anything unusual to php.ini? I used to use apache and php from ports but have always installed Mediwiki from source. Hence, I’ve had to insure that all the needed php extensions are installed. I’ve since switched from apache to nginx, as there was an issue with apache that took a long time to resolve. Marius -- Marius Schamschula