Select Page

# Changing the www-data User Environment for a Perl Script

## The Problem – Rendering Unicode Characters using Glabels

I have a Perl script running on an Apache webserver that launches glabels-3-batch and given a data input file and a glabels template outputs a label as a PDF document.

This is in a Ubuntu 18.04.1 LTS container running on Docker Community Edition on my MacBook Pro

The problem is that I have been using a $\beta$  (beta) character in the file and when running from the command line with a UTF-8 language configured (en_AU.UTF-8) it works fine…

But from a web server, which is running as the www-data user the line with the $\beta$ (beta) value in it is missing…

I’ve traced the problem to not having a LANG environment variable specified in the environment that the www-data user is running under.

## What doesn’t work

PerlSetEnv LANG en_AU.UTF-8
to /etc/apache/apache2.conf
export LANG=en_AU.UTF-8
to /etc/apache/envars
But both of the above didn’t add the LANG setting to the environment

## The Fix

To test the environment I used this script placed at cgi-bin/vars.pl

SetEnv LANG en_AU.UTF-8
to /etc/apache/apache2.conf

## Viewing your mod_perl / CGI Environment

#!/usr/bin/perl -wT
use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

print start_html(&amp;amp;quot;Environment&amp;amp;quot;);

foreach my $key (sort(keys(%ENV))) { print &amp;amp;quot;$key = $ENV{$key}&amp;amp;amp;lt;br&amp;amp;gt;\n&amp;amp;quot;;
}


## Dozens of allow 9009 rules in Windows Firewall

https://www.bleepingcomputer.com/forums/t/642063/keep-seeing-something-hosted-on-port-9009/?p=4202486 Turns out is a...

## Cannot sniff WakeMeOnLan.exe WOL Packets with Wireshark

I am using a Windows 10 PC on my LAN that I am trying to send a WOL magic packet using WakeMeOnLan.exe . I wanted to...

## Test your AV client with Eicar

eicar.com is a special file that is NOT malicious (if gotten from the right place) it is simply a text file with a...