5

I have a problem with the setup of Symfony 2 localy on xampp. The installation was no problem but when I execute the check.php it says:

Your system is not ready to run Symfony2 projects 
 * date.timezone setting must be set
   > Set the "date.timezone" setting in php.ini* (like Europe/Paris).

But the date.timezone in the php.ini is already set correctly.

Patricks
  • 715
  • 2
  • 12
  • 25
  • If you check well your xampp directory you'll find more than one php.ini. Update all of them. This may help you out http://stackoverflow.com/questions/6185319/how-do-i-edit-php-ini-file-in-xampp-server#answer-17502290 – smarber Jan 19 '15 at 13:48
  • But I have only one php.ini located at etc/php.ini and this one is correct – Patricks Jan 19 '15 at 13:55
  • 1
    I am pretty sure, instead of editing the `php.ini` file, you can just put `ini_set('date.timezone', 'Europe/Paris');` in your index file instead. – Sverri M. Olsen Jan 19 '15 at 13:58
  • `phpinfo()` tells the full path of the `php.ini` that was used, have you tried this ? – Niloct Jan 19 '15 at 14:28
  • or run console command "php -i | grep php.ini" it will output the path – john Smith Jan 19 '15 at 14:29
  • Notice that when you run PHP from the command line, a different php.ini file might be used. So you might need to set ````date.timezone```` in for example ````/etc/php5/cli/php.ini````. Also you might need to restart the Apache service after changing your Apache php.ini. – Sander Toonen Jan 19 '15 at 16:31

4 Answers4

4

you can add this to your AppKernel.php

public function init()
{
    // get rid of Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone
    date_default_timezone_set( 'Europe/Paris' );
    parent::init();
}
john Smith
  • 17,409
  • 11
  • 76
  • 117
  • Thanks a lot! php_info() returned the path that was already the correct ini. And there was no other ini. Symfony was running despite the error. But I added the timezone to AppKernel.php and the error dispappeard – Patricks Jan 20 '15 at 14:35
2

for some reason you have to change the date.timezone in

php.ini

in the

cli folder

got the hint when I tried to start a new project in Symfony3.

even if phpinfo() shows that the

php.ini file is in apache2 folder

Bogdan
  • 21
  • 3
0

If you are facing following problem :

Your system is not ready to run Symfony2 projects 
 * date.timezone setting must be set
> Set the "date.timezone" setting in php.ini* (like Europe/Paris)

Simply replace the |localizeddate('long','long') with |date('r') in app/Resources/views/base.html.twig file.

-2

What worked for me is to add the -k option when restarting Apache

raych
  • 1
  • 2