0

Possible Duplicate:
PHP Configuration: It is not safe to rely on the system’s timezone settings
Php errors: Warning: require() [function.require]: open_basedir restriction in effect

My first question here at stackoverflow (please be nice :P)

Why is my apache showing this error?

Severity: Warning

Message: strtotime() [function.strtotime]: 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 'Europe/Berlin' for 'CEST/2.0/DST' instead

Environment

I'm using MacOS Mountain Lion's (10.8.2) Apache.

Things I've tried

  • I've tried to rename my /etc/php.ini.default to /etc/php.ini but when I do, php won't compile anymore.

  • I've also tried to uncomment this line (in the php.ini):

    date.timezone = 'Europe/Berlin'

But it doesn't do anything. As soon as I restart apache the php stops working.

Any ideas?

Thanks in advance.

Community
  • 1
  • 1
Ricard
  • 308
  • 3
  • 9
  • 1
    possible duplicate of [Php errors: Warning: require() \[function.require\]: open\_basedir restriction in effect](http://stackoverflow.com/questions/10345436/php-errors-warning-require-function-require-open-basedir-restriction-in-e). Also please see [So I need to restart Apache after changing the php.ini file?](http://stackoverflow.com/questions/12892331/so-i-need-to-restart-apache-after-changing-the-php-ini-file) – hakre Oct 15 '12 at 09:56
  • Dear Rick please check : http://codingpad.maryspad.com/2012/03/19/setting-the-time-zone-for-php-5-3-x/ -- Your friend Google ;) – metalfight - user868766 Oct 15 '12 at 09:59
  • Also, if it causes PHP to "stop working", you should check your logs. – Leigh Oct 15 '12 at 10:04
  • @Rick: If your problem is to locate the php.ini file that is in effect, please see `INFO_GENERAL` for the [`phpinfo()`](http://php.net/phpinfo) function to locate it on your system. – hakre Oct 15 '12 at 10:05
  • @hakre The phpinfo shows **Configuration File (php.ini) Path = /etc** Right now I have /etc/php.ini.default – Ricard Oct 15 '12 at 10:09
  • Check for loaded configuration files. That entry should name the concrete file name (not only a directory path). Also there might be a list of directories where it is checked in. For more information about PHP.ini files (there can be more than one), please see: http://php.net/manual/en/configuration.file.php – hakre Oct 15 '12 at 10:10
  • @user868766 I did check google before posting :P As a temporal solution I've added this line to my .htaccess **php_value date.timezone Europe/Berlin** – Ricard Oct 15 '12 at 10:15
  • @Rick Glad it worked for you :) – metalfight - user868766 Oct 15 '12 at 10:23
  • @user868766less thanks. I'm still researching to find the php.ini solution, so I don't have to add that line to every project. – Ricard Oct 15 '12 at 10:24

1 Answers1

2

This is PHP message, not Apache. And it is because, as messages indicates, of misconfiguration of your PHP. Edit your correct php.ini file (usually, it ends in /etc/php5/<FLAVOUR>/php.init, where "FLAVOUR" can be apache2, cli or (most likely) cgi (or cgi-bin), for example /etc/php5/apache2/php.ini. Then uncomment date.timezone line and put your timezone, i.e.

date.timezone = Europe/Berlin
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141