Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2024 22:55:23 +0300
From:      =?UTF-8?B?2KfYqNmIINio2YbYr9ixINin2YTYudi12YrZhdmK?= <gaberalasmy@gmail.com>
To:        Marius Schamschula <lists@schamschula.com>
Cc:        freebsd-questions@freebsd.org, Adrian Gschwend <ml-ktk@netlabs.org>
Subject:   Re: Issue with MediaWiki Installation: IntlException and Locale Problems in Apache
Message-ID:  <CAAiXr3EQW67iKj9t-oHH4r=1c3uEP7E=b8TC8WSZMq1bfapu9g@mail.gmail.com>
In-Reply-To: <E6E4D750-B4AD-4448-8A31-ADDD2D89353E@schamschula.com>
References:  <db002b72-0efa-4f4d-bb53-a28ddde77ad2@netlabs.org> <E6E4D750-B4AD-4448-8A31-ADDD2D89353E@schamschula.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Peace be upon you. I have a Garmin device and the OpenSeaMap map (UTF-8)
does not work. Please help.

في الاثنين، ٣٠ سبتمبر ٢٠٢٤, ١٠:٢٧ م Marius Schamschula <
lists@schamschula.com> كتب:

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

[-- Attachment #2 --]
<p dir="ltr">Peace be upon you. I have a Garmin device and the OpenSeaMap map (UTF-8) does not work. Please help.</p>
<br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">في الاثنين، ٣٠ سبتمبر ٢٠٢٤, ١٠:٢٧ م Marius Schamschula &lt;<a href="mailto:lists@schamschula.com">lists@schamschula.com</a>&gt; كتب:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-break:after-white-space"><div><div><blockquote type="cite"><div>On Sep 30, 2024, at 1:39 PM, Adrian Gschwend &lt;<a href="mailto:ml-ktk@netlabs.org" target="_blank" rel="noreferrer">ml-ktk@netlabs.org</a>&gt; wrote:</div><br><div><div>Hi group,<br><br>I&#39;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:<br><br>```<br>IntlException: Constructor failed<br>```<br><br>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.<br><br>I created a minimal PHP test case to see if I could reproduce the error outside of MediaWiki. Here&#39;s the test script:<br><br>```<br>&lt;?php<br><br>// Set the locale to test<br>$locale = &#39;en_US.UTF-8&#39;;<br><br>// Check if Intl extension is loaded<br>if (!extension_loaded(&#39;intl&#39;)) {<br>    die(&quot;Intl extension is not loaded!\n&quot;);<br>}<br><br>// Display the current locale settings<br>echo &quot;Current locale: &quot; . setlocale(LC_ALL, 0) . &quot;\n&quot;;<br><br>// Test the Intl NumberFormatter<br>try {<br>    $formatter = new NumberFormatter($locale, NumberFormatter::DECIMAL);<br>    echo &quot;Number formatting test: &quot; . $formatter-&gt;format(12345.67) . &quot;\n&quot;;<br>} catch (Exception $e) {<br>    echo &quot;IntlException: &quot; . $e-&gt;getMessage() . &quot;\n&quot;;<br>}<br>?&gt;<br><br>```<br><br>Results:<br><br>- Command Line PHP:<br><br>  ```<br>  Current locale: C/C.UTF-8/C/C/C/C<br>  Number formatting test: 12,345.67<br>  ```<br><br>- Apache (via browser):<br><br>  ```<br>  Current locale: C/C.UTF-8/C/C/C/C<br>  IntlException: Constructor failed<br>  ```<br><br>So the same script works on the same jail on cli but not in Apache with mod_php.<br><br>What I&#39;ve Tried<br><br>- I have set `LANG` and `LC_ALL` to `en_US.UTF-8` in both the Apache environment and PHP’s `php.ini`.<br>- I verified that the `Intl` extension is loaded in both CLI and Apache environments.<br>- `phpinfo()` reports the correct locale in Apache (`en_US.UTF-8`), but the error persists.<br><br>I&#39;m really running out of ideas here, I run MediaWiki for years and while it&#39;s a new jail to upgrade my env, this is not something I&#39;ve seen before.<br><br>Note that I tried the same with PHP 8.2, same error.<br><br>Any suggestions on how to resolve this would be greatly appreciated.<br><br>thanks &amp; regards<br><br>Adrian<br><br></div></div></blockquote></div><br></div><div>I have been running Mediawiki on FreeBSD for about ten years. I’ve never seen this issue.</div><div><br></div><div><span style="color:rgb(0,0,0)">How did you install apache, php and Mediawiki? Which version of Mediawiki?</span><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">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?</div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">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.</div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">I’ve since switched from apache to nginx, as there was an issue with apache that took a long time to resolve.</div></div><br><div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Marius</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">--</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Marius Schamschula</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><br>
</div>
<br></div></blockquote></div>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAiXr3EQW67iKj9t-oHH4r=1c3uEP7E=b8TC8WSZMq1bfapu9g>