共有サーバーにsymfony2.7ベースのアプリをセットアップしようとしていますが、php.iniを変更する権限がありません。
実行中: php app/console doctrine:schema:drop --force
この警告/エラーを出力します:
PHP Warning: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message '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.'
0 [internal function]: Symfony\Component\Debug\ErrorHandler- >handleError(2, 'date_default_ti...', '/path...', 272, Array)
1 /domain.com/app/vendor/monolog/monolog/src/Monolog/Logger.php(272): date_default_timezone_get()
2 /domain.com/app/vendor/monolog/monolog/src/Monolog/Logger.php(481): Monolog\Logger->addRecord(100, 'Notified event ...', Array)
3 /domain.com/app/vendor/symfony/ in /domain.com/app/vendor/monolog/monolog/src/Monolog/Logger.php on line 272
PHP Fatal error: date_default_timezone_get(): Timezone database is corrupt - this should *never* happen! in /domain.com/app/vendor/monolog/monolog/src/Monolog/Logger.php on line 272
PHP 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 /domain.com/app/vendor/monolog/monolog/src/Monolog/Logger.php on line 272
PHP Fatal error: date_default_timezone_get(): Timezone database is corrupt - this should *never* happen! in /domain.com
class AppKernel extends Kernel
{
public function init()
{
date_default_timezone_set( 'Europe/Berlin' );
parent::init();
}
}
次のエラーを出力します:
PHP Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Notice: date_default_timezone_set(): Timezone ID 'Europe/Berlin' is invalid' in /domain.com/app/app/AppKernel.php:42
php.netに よるとEurope/Berlin
有効な識別子です。
この回答に よると、timezonedb.so
インストールする必要があります(そうではありません)。
Symfony 1.4のドキュメントによると、で設定default_timezone
することが可能settings.yml
です。の同様の構成が見つかりません>= 2.0
。編集:"Symfony 1.4とは異なり、Symfony2にデフォルトのタイムゾーンを設定するためのdefault_timezone構成パラメーターはありません。[...]"(ソース)
何かアイデア、問題を解決する方法は?
前もって感謝します!
php.iniでタイムゾーンを設定することをお勧めしますが、共有環境にいる場合、または何らかの理由でタイムゾーンにアクセスできない場合は、これをに追加できます。 app/AppKernel.php
class AppKernel extends Kernel
{
public function __construct($environment, $debug)
{
date_default_timezone_set( 'America/Detroit' );
parent::__construct($environment, $debug);
}
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加