linuxserver / docker-bookstack

A Docker container for the BookStack documentation wiki
GNU General Public License v3.0
779 stars 109 forks source link

[BUG] PHP Startup: Invalid date.timezone value '', using 'UTC' instead in Unknown on line 0 #178

Closed escservices closed 1 year ago

escservices commented 1 year ago

Is there an existing issue for this?

Current Behavior

When you run any php command, you'll see this error that the date.timezone value is blank. I don't think it breaks anything, it's just annoying. I have a timezone set in the .env file and TZ is set is in the docker compose for both the database and the app, which both seem to be working.

I found this bug while trying to run some bookstack command (which executed successfully) https://www.bookstackapp.com/docs/admin/commands/

I included one docker-compose below, but I also have another server I recently setup that has a docker compose with database and it has the same issue.

image

Expected Behavior

Running PHP commands don't throw PHP warning, timezone is passed through the docker compose to the PHP config.

Steps To Reproduce

  1. Setup Bookstack
  2. Type PHP inside container.

Environment

- OS: RockyLinux 9.2
- How docker service was installed: repos on main docker website.

CPU architecture

x86-64

Docker creation

---
version: "2"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack:latest
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=https://asdfasdfasdfasdf
      - TZ=US/Eastern
    volumes:
      - /var/www/BookStack:/config
    ports:
      - 6875:80
    restart: unless-stopped

Container logs

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────

using keys found in /config/keys
App Key found - setting variable for seds
Waiting for DB to be available
PHP Warning:  PHP Startup: Invalid date.timezone value '', using 'UTC' instead in Unknown on line 0

   INFO  Nothing to migrate.  

**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐
│  old date  │  new date  │ path                                                                   │
├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤
│ 2022-08-16 │ 2023-04-13 │ /config/nginx/nginx.conf                                               │
│ 2022-10-04 │ 2023-04-13 │ /config/nginx/site-confs/default.conf                                  │
└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘
[custom-init] No custom files found, skipping...
[ls.io-init] done.
[13-Jun-2023 14:40:25] NOTICE: PHP message: PHP Warning:  PHP Startup: Invalid date.timezone value '', using 'UTC' instead in Unknown on line 0
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

ssddanbrown commented 1 year ago

@escservices Might be worth confirming your exact container image version, and also ensuring you're on the latest image version. There have been some very recent changes to address this. More context in this thread and this PR of the base image.

escservices commented 1 year ago

Hi

Sorry about that; this is the exact build version -

Linuxserver.io version:- v23.05.2-ls85 Build-date:- 2023-06-12T18:23:03+00:00

Image - lscr.io/linuxserver/bookstack:v23.05.2-ls85

nemchik commented 1 year ago

can you (inside the container) run cat /etc/php82/conf.d/30_timezone.ini

escservices commented 1 year ago

So, on two of my servers, it shows date.timezone = US/Eastern and on the newest one it shows date.timezone = UTC. For some reason, the newest one, which is using the exact same image and is also running on RockyLinux, doesn't have the PHP warning, it's also the one showing UTC. It also doesn't have a TZ set in the docker compose.

I tried removing the TZ from other instances, and I tried setting the TZ to UTC, no luck in either case. The timezone id updating correctly though as I change it in the compose. The newest server that is working, I updated to US/Eastern and it works fine and reflects the change in that 30_timezone.ini file.

Could it be some kind of native Linux package that handles dates/times/timezones that's missing? One server was built in Azure, one is on-prem running in ESXI, and one is in Vultr, the one built on Vultr's Rocky image is the only server without the issue.

dschoepel commented 1 year ago

I had same problem, found that the php-local.ini file was missing the time zone name for the date.timezone = statement. This file was in the /config/php folder. Might be worth looking at...

nemchik commented 1 year ago

We recently moved around the logic in our base image that is responsible for telling PHP what timezone you are using, and also added UTC as a fallback in the way we set the timezone so that PHP doesn't display the warning where it says it's falling back to UTC anyway.

We set the timezone inside the container in /etc/php82/conf.d/30_timezone.ini and the logic for it is here https://github.com/linuxserver/docker-baseimage-alpine-nginx/blob/0ff477bdecba9064b07fd57e2cd354eb928202e1/root/etc/s6-overlay/s6-rc.d/init-php/run#L5 and we no longer set the timezone in /config/php/php-local.ini because it's not needed in two files. If you manually set it in /config/php/php-local.ini your setting should take priority.

dschoepel commented 1 year ago

In my case - somehow, I had this in the local file, I commented out the time zone statement in the php-local.ini file since it was covered in the /etc/php82/conf.d/30_timezone.ini file. All good no warning message now. Thanks for the explanation, very much appreciated!

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue is locked due to inactivity