After setting system time, I discovered that mysql and php services didn’t also update the timezone settings. Here’s how to make sure they also reflect the correct timezone.
First locate all the php.ini files in /etc
cd /etc/
find . | grep php.ini
./php/7.4/apache2/php.ini
./php/7.4/cli/php.ini
now edit these files and add the timezone info
nano ./php/7.4/apache2/php.ini
add this to the [Date] block:
[Date]
date.timezone = "America/New_York"
For mysqld portion, first copy timezone data into mysql tables:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
Here’s a quick and easy way to change the timezone configuration on Raspian / Debian / Ubuntu server, but will probably work on other linux flavors as well.
First, lets see what our current configuration is:
timedatectl
Local time: Fri 2021-09-10 19:13:06 BST
Universal time: Fri 2021-09-10 18:13:06 UTC
RTC time: n/a
Time zone: Europe/London (BST, +0100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
To get a list of all the supported time-zones:
timedatectl list-timezones
And something like this to grep for relevant ones:
timedatectl list-timezones | grep "America"
Next, lets set our time-zone:
sudo timedatectl set-timezone America/New_York
Finally, check to make sure the changes were applied:
timedatectl
Local time: Fri 2021-09-10 14:21:42 EDT
Universal time: Fri 2021-09-10 18:21:42 UTC
RTC time: n/a
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Say you want to create a simple password protected folder in order to share some sensitive documents or what have you. Using apache2 and HTTP Basic Auth, this can be accomplished in only a few commands.
An Example of simple HTTP Basic Auth Login
First, create a folder in your web directory.
sudo mkdir /var/www/html/protected
Then, you will want to setup the username/password you want to use for the login.