From nobody Mon Sep 30 19:26:52 2024 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XHWKk0kTrz5XYDB for ; Mon, 30 Sep 2024 19:27:06 +0000 (UTC) (envelope-from lists@schamschula.com) Received: from toucan.tulip.relay.mailchannels.net (toucan.tulip.relay.mailchannels.net [23.83.218.254]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4XHWKj2yrCz44Dl for ; Mon, 30 Sep 2024 19:27:05 +0000 (UTC) (envelope-from lists@schamschula.com) Authentication-Results: mx1.freebsd.org; none X-Sender-Id: dreamhost|x-authsender|lists@schamschula.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id DF08C891CE; Mon, 30 Sep 2024 19:27:03 +0000 (UTC) Received: from pdx1-sub0-mail-a316.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8196E891E0; Mon, 30 Sep 2024 19:27:03 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1727724423; a=rsa-sha256; cv=none; b=vXoksyNXI85pAKinzHSMHqFMDcECz240OdFPSZSOBzEhuHgTDNgVW7qEO/9Me8KsYZuLFL gwys6BfzimaysuES/0NPPzDsTpgpGeZzCLKZWF2DgaC89ejCwquLsoTs/1a8Iakdk8zAgZ 8K5SdjbF9/5XsSgusF74wi+6G6vK+7Hy8f2Db90/XfZjG21Gvivyndc4Kkkfp2clomeJBP HkIQEJ+MOtzx/uHgv+N/I2euvtB+u3jYcA8N+cR0a0LTBowWMTu78nPJEXyOj95X74CqdW IuqO//uGTJQGsRmcC+8R/8uoSPfu2Z8qwA05azzYgmITClP50boHs2JRfJfm9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1727724423; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GtYAUucV0NOKTZAl0MzK1+9n2jn4xTWx6inAkMYur78=; b=Z3nr+50E9HoQcQ+Z6BX8VdOScDNBLDPwiq+LwzCzEGAxiA1pV+FvJiF4dBykKrrQCvsAR9 2tBGKOMQJ51f35pyrmaBb41PP3xzRkBdHsD0whaBuIlaK7xLLy+QQ0e3aZAk/7tIwyOqVr 8uCWauXpxiYStgBrOPNzZMYpkj+5sVr/+4zJi20NqW9Pb035azf+cdEPMGgAJe9JOnYitG A/7fh1DJ0qWRfj+xOmfcb5glwv/Gdg7fp+dbbQCvNyBMLApdns7k0/fKNOovPS3GhpSwe5 pytmvnOUjxjvhFyqOG+/DCY8Z8GpsxDw/bX3x5xrniwisga+ekjlqc7RFn21RA== ARC-Authentication-Results: i=1; rspamd-5b468d8b77-d6crh; auth=pass smtp.auth=dreamhost smtp.mailfrom=lists@schamschula.com X-Sender-Id: dreamhost|x-authsender|lists@schamschula.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|lists@schamschula.com X-MailChannels-Auth-Id: dreamhost X-Daffy-Reaction: 388dcfa26efe3d24_1727724423758_3190216019 X-MC-Loop-Signature: 1727724423758:278824290 X-MC-Ingress-Time: 1727724423758 Received: from pdx1-sub0-mail-a316.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.113.46.137 (trex/7.0.2); Mon, 30 Sep 2024 19:27:03 +0000 Received: from smtpclient.apple (unknown [204.27.217.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lists@schamschula.com) by pdx1-sub0-mail-a316.dreamhost.com (Postfix) with ESMTPSA id 4XHWKg185HzBC; Mon, 30 Sep 2024 12:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schamschula.com; s=dreamhost; t=1727724423; bh=GtYAUucV0NOKTZAl0MzK1+9n2jn4xTWx6inAkMYur78=; h=From:Content-Type:Subject:Date:Cc:To; b=O/rllp2vxZKvRPU831hZOG8dD9/znOn3nt+xU+7n8Gkzlx2vLJYsXYLEP1oH4x9lD r7r1cY8DB3FW3Ff2Dgj403ioIkaIGYKQKLX88maMzXSBLsIO20N4ItbauYL0JZl2JM 2WYMlpKwCZqDqHrDh8GIzstyxB9aHtg8s07Id363b53IEMkL+CvvL/Th2F2uol2liO S6YyMhXqiFhNnuZq8rVzOfpN3CObXXTpAphk+H4SSwkHk/r2MPnC+ymKWL2Chda8ok u2yAZYEr13B4Q0XQVDBwczSA9LGx3kfEFgqf3BuOz8fXJAytDrrdanZIQpjZ1C5Fa3 vxhu+7zg+cBxA== From: Marius Schamschula Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_D957159D-2CBA-48B3-BCB9-F1A380717B69" List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: Issue with MediaWiki Installation: IntlException and Locale Problems in Apache Date: Mon, 30 Sep 2024 14:26:52 -0500 In-Reply-To: Cc: Adrian Gschwend To: freebsd-questions@freebsd.org References: X-Mailer: Apple Mail (2.3776.700.51.11.1) X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:63213, ipnet:23.83.216.0/22, country:CA] X-Rspamd-Queue-Id: 4XHWKj2yrCz44Dl X-Spamd-Bar: ---- --Apple-Mail=_D957159D-2CBA-48B3-BCB9-F1A380717B69 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Sep 30, 2024, at 1:39=E2=80=AFPM, Adrian Gschwend = wrote: >=20 > Hi group, >=20 > 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: >=20 > ``` > IntlException: Constructor failed > ``` >=20 > 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. >=20 > I created a minimal PHP test case to see if I could reproduce the = error outside of MediaWiki. Here's the test script: >=20 > ``` > =20 > // Set the locale to test > $locale =3D 'en_US.UTF-8'; >=20 > // Check if Intl extension is loaded > if (!extension_loaded('intl')) { > die("Intl extension is not loaded!\n"); > } >=20 > // Display the current locale settings > echo "Current locale: " . setlocale(LC_ALL, 0) . "\n"; >=20 > // Test the Intl NumberFormatter > try { > $formatter =3D new NumberFormatter($locale, = NumberFormatter::DECIMAL); > echo "Number formatting test: " . $formatter->format(12345.67) . = "\n"; > } catch (Exception $e) { > echo "IntlException: " . $e->getMessage() . "\n"; > } > ?> >=20 > ``` >=20 > Results: >=20 > - Command Line PHP: >=20 > ``` > Current locale: C/C.UTF-8/C/C/C/C > Number formatting test: 12,345.67 > ``` >=20 > - Apache (via browser): >=20 > ``` > Current locale: C/C.UTF-8/C/C/C/C > IntlException: Constructor failed > ``` >=20 > So the same script works on the same jail on cli but not in Apache = with mod_php. >=20 > What I've Tried >=20 > - I have set `LANG` and `LC_ALL` to `en_US.UTF-8` in both the Apache = environment and PHP=E2=80=99s `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. >=20 > 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. >=20 > Note that I tried the same with PHP 8.2, same error. >=20 > Any suggestions on how to resolve this would be greatly appreciated. >=20 > thanks & regards >=20 > Adrian >=20 I have been running Mediawiki on FreeBSD for about ten years. I=E2=80=99ve= 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=E2=80=99ve had to insure that all the = needed php extensions are installed. I=E2=80=99ve since switched from apache to nginx, as there was an issue = with apache that took a long time to resolve. Marius -- Marius Schamschula --Apple-Mail=_D957159D-2CBA-48B3-BCB9-F1A380717B69 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Sep 30, = 2024, at 1:39=E2=80=AFPM, 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 =3D '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 =3D 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=E2=80=99s `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=E2=80=99v= e 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=E2=80=99ve had to insure that all the = needed php extensions are installed.

I=E2=80=99ve since switched from = apache to nginx, as there was an issue with apache that took a long time = to resolve.

Marius
--
Marius Schamschula



= --Apple-Mail=_D957159D-2CBA-48B3-BCB9-F1A380717B69--