I have Backdrop CMS running correctly on my localhost (mac/MAMP) and have completed the site, ready for live deployment.

I used github to git init a repository and add all my files, which I then pushed everything to successfully.

I setup ssh access on my live server (cPanel shared hosting) tested with no problems, git cloned with no problems.

Confirmed PHP and opcache settings were correct.

I then added settings.php file manually (as it was set to be ignored by the .gitignore file).

I did this by creating it empty in cpanel File manager, and editing/pasting the contents as is, from my localhost's Backdrop settings.php file.

I then loaded the URL in my browser for the site mydomain.com/mydirectory

which loaded Backdrop interface, which the following error:

Exception: The configuration directory in settings.php is specified as './files/config_d288997df7e59ac84f89c0935818f46d/active', but this directory is either empty or missing crucial files. Check that the $config_directories variable is correct in settings.php. in _backdrop_bootstrap_configuration() (line 2998 of /home/coastto1/public_html/dylan-bdrop/core/includes/bootstrap.inc).

 

How do I fix this error?

UPDATE: I noticed my settings.php was referencing a directory that git did not push to cpanel. I realised the defaul .gitignore file has /files directory set to be ignored (where the config directory is stored), so I removed /files from the .gitignore file and then added files directory to git, pushed it to github, and then git pulled it on my cpanel.

Now, when I load my main site url:

mydomain.com/mydirectory

I no longer get the config warning, but instead I just get the stock standard drupal/backdrop error of:

The website encountered an unexpected error. Please try again later.

What next? I am going to check if there is any trusted_host details in settings.php that I need to change.....

UPDATE 2: I cannot find any "trusted_host_patterns" data inside my settings.php file so I guess that is not the problem?

What other settings in my settings.php file would be OK on my localhost, but not OK on my Live/cPanel server?

 

Accepted answer

Hi Klonos,

yes the error was fixed for me, when I replaced this line in my settings.php file:

$database = 'mysql://backgropdpbuser:(password)@localhost/backdropdb';

with this:

$databases['default']['default'] = array (
  'database' => 'coastto1_backdropdb',
  'username' => 'coastto1_backgropdpbuser',
  'password' => '(password)',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'driver' => 'mysql',
);

NOTE: My password doesn't have open/close brackets in it, just letters and numbers. the "(password)" is just a placeholder for where it should be.

Comments

The first thing to do is to confirm that you have config directories in your files directory that match the configuration settings in settings.php that look like this:

from settings.php

$config_directories['active'] = './files/config_f937fa07ffd17fcb4rgt06a8b48ef808/active';
$config_directories['staging'] = './files/config_f937fa07ffd17fcb4rgt06a8b48ef808/staging';

in backdrop root:

files/config_f937fa07ffd17fcb4rgt06a8b48ef808/active
files/config_f937fa07ffd17fcb4rgt06a8b48ef808/staging

These must match exactly. 

If you are going through the install process, the "active" config directory must start out empty. If you are importing the database directly, you will need to make sure that the files in your active directory match the files on your dev server/host.

Sometimes, when moving config files I have to enable modules on receiving site before I can get the config to load. You will usually get a useful error message if that is the case. 

The other common problem with setting up config directories are permissions. 

https://github.com/backdrop/backdrop-issues/issues/264

 

 

Thanks for your reply Tim,

I'll reply via the github thread for now, and If I reach a conclusion there I'll come back here and clarify things once done.

klonos's picture

Hello @auxiliaryjoel,

I see in https://github.com/backdrop/backdrop-issues/issues/264 that you have sorted the problems you were having. Can you please sum up what seemed to be the problem after all?

PS: for the record, there is currently no support for "trusted_host_patterns" in Backdrop, but this is coming with 1.14.0 (to be released on September 15); see https://github.com/backdrop/backdrop-issues/issues/2568. The Backdrop implementation is not going to be as "strict" as the Drupal implementation. That is, it will be possible to specify "trusted_host_patterns" in your settings.php, but it will be opt-in (in other words, your site will not stop working if you don't specify it).

Hi Klonos,

yes the error was fixed for me, when I replaced this line in my settings.php file:

$database = 'mysql://backgropdpbuser:(password)@localhost/backdropdb';

with this:

$databases['default']['default'] = array (
  'database' => 'coastto1_backdropdb',
  'username' => 'coastto1_backgropdpbuser',
  'password' => '(password)',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'driver' => 'mysql',
);

NOTE: My password doesn't have open/close brackets in it, just letters and numbers. the "(password)" is just a placeholder for where it should be.