Moving site to host error: getConfigRepository() on null
Permalink
Hello,
The website is working in my local development environment but when I upload everyting to the hosting provider I receive the following error:
Call to a member function getConfigRepository() on null
I tried this on two different providers. I am using PHP 7.1.19 and tested with concrete 8.40 and 8.4.1 (download version and via composer install).
Some advice would be appreciated.
The website is working in my local development environment but when I upload everyting to the hosting provider I receive the following error:
Call to a member function getConfigRepository() on null
$config = $this->app->make('config'); if (!$config->has('app.server_timezone')) { // There is no server timezone set. $config->set('app.server_timezone', @date_default_timezone_get() ?: 'UTC'); } @date_default_timezone_set($config->get('app.server_timezone')); } protected function initializeSiteTimezone() { $siteConfig = $this->app->make('site')->getSite()->getConfigRepository(); if (!$siteConfig->has('timezone')) { // There is no timezone set. $siteConfig->set('timezone', @date_default_timezone_get()); } }
Viewing 15 lines of 20 lines. View entire code block.
I tried this on two different providers. I am using PHP 7.1.19 and tested with concrete 8.40 and 8.4.1 (download version and via composer install).
Some advice would be appreciated.