• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

php.ini inheritance not working for date.timezone

AdamNJ

New Pleskian
The php.ini inheritance not working as it should at least for the property 'date.timezone'.

I use the php date() function in my web sites (which previously were on a 4.x version of php on another server), and it's usage is causing an error to be logged in the site's apache error_log file:

mod_fcgid: stderr: PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in [filename] on line 10

information on my server:
OS: CentOS 5.8 (Final)
Panel version: 11.0.9 Update #15
server default config: /etc/php.ini
local config: /var/www/vhosts/[domain]/etc/php.ini
php ran as: FastCGI
web host company: Media Temple (dv) 4.0
I just purchased this new web hosting server 2 weeks ago so I wouldn't expect the issue to be caused by some Panel update not applying correctly.

The local *_http.include files correctly have:
SetEnv PP_CUSTOM_PHP_INI /var/www/vhosts/[domain]/etc/php.ini

<IfModule mod_fcgid.c>
FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/[domain]/etc/php.ini
FcgidMaxRequestLen 16777216
</IfModule>



I set the property correct in the server default file @ /etc/php.ini (date.timezone = "America/New_York"), then restarted apache, and then the whole server, neither worked. Then I discovered the local config file. There was no line in there for date.timezone, but there was a [date] section. I removed that section, then restarted apache, and then the whole server, neither worked. I had to remove the local config file in order for it to pick up the property (as well as everything else) from the server default. The other alternative is to add the property to the local config (either manually or through Plesk).

This is not something I want to be forced to change each time I add a new domain/webspace.

I would expect the property's value to be pulled from the server default file if it wasn't in the local, based on what is described here: http://download1.parallels.com/Ples...inistrator-guide/index.htm?fileName=69696.htm



Additionally, is there a skeleton php.ini file located somewhere which is used to create the local config when a new webspace is added? I could not find one.
 
Hey there Adam!

I'm not too familiar with this specific issue but I wanted to reach out to you and let you know about this article we have on changing timezones on servers here at (mt) Media Temple:

http://kb.mediatemple.net/questions/51/How+do+I+change+the+time+zone+on+my+server?#dv_40

I know that doesn't pertain to your php.ini file but just wanted to make you aware of it in case it sheds any light on your situation. Additionally, if you have any questions you feel we can answer for you here at (mt) Media Temple, we're on the phone, chat and Twitter 24/7 so feel free to get in touch. :)

Drew J
(mt) Media Temple
Social Media Team
@MediaTemple
 
Back
Top