6

Snapshot of the output of phpinfo() function:

enter image description here

As I am trying to install Roundcube which requires to set date.timezone, I would like to set date.timezone by filling the date.timezone field in php.ini.

Server Configuration

  • Debian 9 (Stretch)
  • PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS )
  • Apache/2.4.25 (Debian)

What I tried

According to http://php.net/manual/en/timezones.php, I modified the date.timezone field from both /etc/php/7.0/apache2/php.ini and /etc/php/7.0/cli/php.ini with different syntaxes:

date.timezone = Europe/Paris
date.timezone = 'Europe/Paris'
date.timezone = "Europe/Paris"

And I always restarted Apache after any change.

Nothing change in phpinfo, the date.timezone field is always set to "no value" and the first step of the installation of Roundcube, date.timezone is NOT OK.

But when I try:

php -i

I get:

date/time support => enabled
"Olson" Timezone Database Version => 0.system
Timezone Database => internal
Default timezone => Europe/Paris

Directive => Local Value => Master Value
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.583333 => 90.583333
date.sunset_zenith => 90.583333 => 90.583333
date.timezone => Europe/Paris => Europe/Paris

I read many pretty old posts about this type of issue but the different solutions did not work for me. Any idea?

EDIT

According to phpinfo():

Configuration File (php.ini) Path

/etc/php/7.0/apache2

Loaded Configuration File

/etc/php/7.0/apache2/php.ini

Scan this dir for additional .ini files

/etc/php/7.0/apache2/conf.d

Additional .ini files parsed

/etc/php/7.0/apache2/conf.d/10-mysqlnd.ini, /etc/php/7.0/apache2/conf.d/10-opcache.ini, /etc/php/7.0/apache2/conf.d/10-pdo.ini, /etc/php/7.0/apache2/conf.d/15-xml.ini, /etc/php/7.0/apache2/conf.d/20-calendar.ini, /etc/php/7.0/apache2/conf.d/20-ctype.ini, /etc/php/7.0/apache2/conf.d/20-curl.ini, /etc/php/7.0/apache2/conf.d/20-dom.ini, /etc/php/7.0/apache2/conf.d/20-exif.ini, /etc/php/7.0/apache2/conf.d/20-fileinfo.ini, /etc/php/7.0/apache2/conf.d/20-ftp.ini, /etc/php/7.0/apache2/conf.d/20-gd.ini, /etc/php/7.0/apache2/conf.d/20-gettext.ini, /etc/php/7.0/apache2/conf.d/20-iconv.ini, /etc/php/7.0/apache2/conf.d/20-imagick.ini, /etc/php/7.0/apache2/conf.d/20-imap.ini, /etc/php/7.0/apache2/conf.d/20-intl.ini, /etc/php/7.0/apache2/conf.d/20-json.ini, /etc/php/7.0/apache2/conf.d/20-mbstring.ini, /etc/php/7.0/apache2/conf.d/20-mcrypt.ini, /etc/php/7.0/apache2/conf.d/20-memcache.ini, /etc/php/7.0/apache2/conf.d/20-mysqli.ini, /etc/php/7.0/apache2/conf.d/20-pdo_mysql.ini, /etc/php/7.0/apache2/conf.d/20-pdo_sqlite.ini, /etc/php/7.0/apache2/conf.d/20-phar.ini, /etc/php/7.0/apache2/conf.d/20-posix.ini, /etc/php/7.0/apache2/conf.d/20-pspell.ini, /etc/php/7.0/apache2/conf.d/20-readline.ini, /etc/php/7.0/apache2/conf.d/20-recode.ini, /etc/php/7.0/apache2/conf.d/20-shmop.ini, /etc/php/7.0/apache2/conf.d/20-simplexml.ini, /etc/php/7.0/apache2/conf.d/20-snmp.ini, /etc/php/7.0/apache2/conf.d/20-sockets.ini, /etc/php/7.0/apache2/conf.d/20-sqlite3.ini, /etc/php/7.0/apache2/conf.d/20-sysvmsg.ini, /etc/php/7.0/apache2/conf.d/20-sysvsem.ini, /etc/php/7.0/apache2/conf.d/20-sysvshm.ini, /etc/php/7.0/apache2/conf.d/20-tidy.ini, /etc/php/7.0/apache2/conf.d/20-tokenizer.ini, /etc/php/7.0/apache2/conf.d/20-wddx.ini, /etc/php/7.0/apache2/conf.d/20-xmlreader.ini, /etc/php/7.0/apache2/conf.d/20-xmlrpc.ini, /etc/php/7.0/apache2/conf.d/20-xmlwriter.ini, /etc/php/7.0/apache2/conf.d/20-xsl.ini

7
  • 1
    you cli ini is fine, but the non cli one obviously has something wrong. do a phpinfo() on a page, and search for .ini to see which ini files were parsed, then check they dont have an overriding setting Commented Oct 17, 2017 at 11:22
  • use php ini_set : stackoverflow.com/questions/15096297/… Commented Oct 17, 2017 at 11:23
  • @FarhangNegari The user is trying to install some software. I would not recommend changing the software's source code. Commented Oct 17, 2017 at 11:25
  • @delboy1978uk I have edited the additional .ini files parsed. Commented Oct 17, 2017 at 11:32
  • @FarhangNegari I am not sure that ini_set will resolve my problem because I want to set date.timezone properly for the Roundcube installation. Commented Oct 17, 2017 at 11:33

5 Answers 5

6

I faced the similar problem problem. 'date.timezone' in php.ini is showin as 'not set' / 'no value' when running php under apache. Checked through phpinfo(). Issue not solved even when apache is restarted. It is solved by restarting php-fpm service ( Fast cgi process manager).

systemctl restart php-fpm

[I am not a native speaker of English. I tried my best to edit the answer after going through the message in my stackoverflow INBOX].

Sign up to request clarification or add additional context in comments.

2 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
That's it. I have a HTTP/2 setup on my Apache server, sudo service apache2 restart was not enough after modifying the timezone in the ini file, but sudo service php8.2-fpm restart solved it.
1

I have found the problem. It was a syntax error in my php.ini file in the error_reporting area.

Comments

1

Let me contribute something: I was installing SilverStripe on a VPS and had the exact same problem. I have been searching the answer the whole late afternoon without positive outcome. After all attempts, I removed the ";" in front of

[Date]

; Defines the default timezone used by the date functions

;date.timezone = Europe/London

Here is where I got the answer: https://www.silverstripe.org/community/forums/installing-silverstripe/show/15398?start=8

Hope everyone avoids this trouble

Comments

1

I noticed it was different in two places in my php.ini file for xampp, here:

   [Date]
   ; Defines the default timezone used by the date functions
   ; http://php.net/date.timezone
   date.timezone = "America/Phoenix"```

and here:

; List of headers files to preload, wildcard patterns allowed.
;ffi.preload=
[Syslog]
define_syslog_variables=Off
[Session] 
define_syslog_variables=Off
[Date]
date.timezone=Europe/Berlin```

Note they are different--I have no idea how "Europe/Berlin" got in my php.ini. I noticed this showing up in my php error logs and searched through the whole xampp folder.

Comments

0

php_info() will always indicate the path of the .ini that's being used, ensure this is correct, and aligns with the ini that your are editing.

1 Comment

This should be written as a comment, since we don't know 100% if that is the issue or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.