#974922 libapache2-mod-perl2: "mod_perl interferes with mod_php locales, unable to use gettext translations"

Package:
libapache2-mod-perl2
Source:
libapache2-mod-perl2
Description:
Integration of perl with the Apache2 web server
Submitter:
Claudio Kuenzler
Date:
2023-04-21 14:57:09 UTC
Severity:
important
Tags:
#974922#5
Date:
2020-11-16 14:26:45 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***
-------------8<---------- End Bug Report --------------8<----------

#974922#8
Date:
2020-11-18 07:35:50 UTC
From:
To:
Hi Claudio,
-=| Claudio Kuenzler, 16.11.2020 15:26:45 +0100 |=-

It would be nice if you could share the translate.php contents (or
a minimal version) so that the issue can be reproduced and any
prospective fixes/workarounds be tested.

#974922#13
Date:
2020-11-18 08:02:42 UTC
From:
To:
Hi Damyan,

Thanks for your follow-up!

As a matter of fact, I was right in the middle of reproducing this on
another Debian 10 machine. It can be reproduced easily.

Just use a standard Apache installation with libapache2-mod-php7.3, place
the translate.php in the document root and create the locale structure in
the same path as translate.php: ./locale/de_CH.UTF-8/LC_MESSAGES/
Inside LC_MESSAGES place a homepage.po file, here's an example:
------- cut ------- # Sample translation. # Copyright (C) 2020 Infiniroot. # Infiniroot LLC <redacted@example.com>, 2020. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Infiniroot 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-16 10:00+0100\n" "PO-Revision-Date: 2020-11-16 10:00+0100\n" "Last-Translator: Infiniroot <redacted@example.com>\n" "Language-Team: Infiniroot <redacted@example.com>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" # Home page msgid "Dedicated Hosting Description" msgstr "Mein deutscher Text" ------- cut ------- Then use msgfmt command (from the gettext package) to create a binary mo file: cd locale/de_CH.UTF-8/LC_MESSAGES/; msgfmt homepage.po --output-file=homepage.mo -v When you now launch the translate.php file through Apache (you can use curl), it should translate and show the German translation. $ curl localhost/translate.php Mein deutscher Text Then install and enable the libapache2-mod-perl2 module and restart Apache. The translation stops working. $ curl localhost/translate.php Original English was returned. Something wrong I published a blog article about this behaviour yesterday: https://www.claudiokuenzler.com/blog/1023/php-gettext-translations-not-working-apache-mod_php-cli-works. The sample translate.php is included in the article. Hope this helps. Am available for debugging this together if you want.
#974922#18
Date:
2020-11-19 07:09:26 UTC
From:
To:
The same bug can also be reproduced in the current unstable (bullseye) by
the way.

apache2 2.4.46-2
libapache2-mod-perl2 2.0.11-2+b1
libapache2-mod-php7.4 7.4.11-1
perl 5.32.0-5

As there is another bug in Mageia Linux (see
https://bugs.mageia.org/show_bug.cgi?id=25411) which points to (probably)
the same issue, it would seem an upstream bug of mod_perl.

#974922#23
Date:
2023-04-21 14:53:45 UTC
From:
To:
Still actual for  Ubuntu 22.04

# dpkg -l | grep apach | grep -i perl
ii  libapache2-mod-perl2
 2.0.12-1build1                               amd64        Integration of
perl with the Apache2 web server
ii  libapache2-reload-perl                                      0.13-3
                                  all          module for reloading Perl
modules when changed on disk

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

After removing the libapache2-mod-perl2 package issue gone.