PHP Error 500: Timezone database is corrupt - this should *never* happen

5,355

Solution:

mkdir -p /var/www/usr/lib/locale
mkdir -p /var/www/usr/share/zoneinfo

cd /var/www
cp /etc/localtime etc/localtime
cp /usr/share/zoneinfo/ usr/share/zoneinfo/

This fix the Problem (there were more errors with NectCloud and Chroot e.g. locale that i've fixed with same procedures).

Share:
5,355

Related videos on Youtube

Arny80Hexa
Author by

Arny80Hexa

Updated on September 18, 2022

Comments

  • Arny80Hexa
    Arny80Hexa over 1 year

    I have a fresh install of an Ubuntu Server 16.04 amd64 with apache 2.4.18 and php 7.0.

    I have chrooted the Apache with mod_env and ChrootDir /var/www in /etc/apache2/apache2.conf and far as I know is here the problem. I want to do a NexctCloud 11 Installation, but on first run it runs into a 500 Error.

    Apache Error Log:

    [Fri Mar 17 08:21:22.262901 2017] [:error] [pid 31480] [client 193.175.51.226:55749] PHP Notice:  date_default_timezone_set(): Timezone ID 'UTC' is invalid in /html/sub.example.com/public_html/lib/base.php on line 637, referer: https://sub.example.com/
    [Fri Mar 17 08:21:22.266581 2017] [:error] [pid 31480] [client 193.175.51.226:55749] PHP Warning:  DateTime::createFromFormat(): Invalid date.timezone value 'Europe/Berlin', we selected the timezone 'UTC' for now. in /html/sub.example.com/public_html/lib/private/Log/File.php on line 85, referer: https://sub.example.com/
    [Fri Mar 17 08:21:22.266610 2017] [:error] [pid 31480] [client 193.175.51.226:55749] PHP Fatal error:  DateTime::createFromFormat(): Timezone database is corrupt - this should *never* happen! in /html/sub.example.com/public_html/lib/private/Log/File.php on line 85, referer: https://sub.example.com/
    

    If I deactivate the Chroot, everything is fine, but I prefer a other solution where I dont have to deactivate the chroot.

    I have found one suggestion on the web: http://ivanbayan.com/index.php/2013/06/26/how-to-fix-timezone-database-is-corrupt-this-should-never-happen/ which I have tryed out (customized for my php7), but it didnt solve the problem. Also I have tryed some suggestions from here without solving my problem: PHP Startup: Timezone database is corrupt

    //Edit: It seems that is not only a problem with NextCloud. It is a Problem using date() function in PHP. The following script resultes in the same error:

    <?php
    date_default_timezone_set('Europe/Berlin');
    
    echo date("l");
    ?>