Reputation: 2824
I have tried everything under the sun to enable the ability to run this command after installing Symfony2.
php app/console cache:clear --no-warmup OR php app/console cache:clear
I get this error every time:
[ErrorException] Warning: date_default_timezone_get(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Applications/XAMPP/xamppfiles/htdocs/rt/vendor/jms/serializer-bundle/JMS/SerializerBundle/DependencyInjection Configuration.php line 66
On line 66:
->scalarNode('default_timezone')->defaultValue(date_default_timezone_get())->end()
I've tried this Stack Post:
I've tried to edit ALL php.ini files, phpinfo() for XAMPP shows:
date/time support enabled "Olson" Timezone Database Version 2013.4 Timezone Database internal Default timezone UTC
$ php --ini shows
Configuration File (php.ini) Path: /etc (I edited this one as well)
php.ini shows
date.timezone = UTC
I cannot run php composer.phar install without the ability to get past this stupid date_default_timezone_set() error.
Please help, its been 2 haggling days trying to get this fixed and I am at my wits end.
Thanks!
Upvotes: 0
Views: 1710
Reputation: 1273
You can add a default timezone to your php.ini http://www.inmotionhosting.com/support/website/php/setting-the-timezone-for-php-in-the-phpini-file Don't forget to restart the server
Upvotes: 0
Reputation: 258
Add the below in your virtualhost file as suggested above
php_value date.timezone America/Caracas
You can also have the same in the .htaccess file in the web folder of your symfony2 instead.
Check the php.ini under both
/etc/php5/apache2/ ( for apache2 )
and
/etc/php5/cli/ ( for command line )
Upvotes: 0
Reputation: 13755
A good option is also to add the following into the virtualhost file (if applicable)
php_value date.timezone America/Caracas
Upvotes: 0
Reputation: 5082
I've solved this issue adding this code to the app/AppKernel.php
file:
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel {
public function init() {
// Change timezone
date_default_timezone_set('America/Caracas');
parent::init();
}
// ......
}
Upvotes: 2