Why when I do a configuration export does the config.tar.gz in tmp not get copied to the sync folder? This happens when I use the UI and drush cex. The config.tar.gz is created in the tmp folder but nothing is created in the sync folder that I created in sites/default.

I have searched for similar tickets here, on Drupal.org and searching in google! I find references to folder and file permissions (I have tried 777 on most) and references to a .htaccess file in the sites/default folder with specific content.

The content my .htaccess file in sites/default is:

# Deny all requests from Apache 2.4+.
&lt;IfModule mod_authz_core.c&gt;
  Require all denied
&lt;/IfModule&gt;

# Deny all requests from Apache 2.0-2.2.
&lt;IfModule !mod_authz_core.c&gt;
  Deny from all
&lt;/IfModule&gt;
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
&lt;Files *&gt;
    # Override the handler again if we're run later in the evaluation list.
    SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
&lt;/Files&gt;

# If we know how to do it safely, disable the PHP engine entirely.
&lt;IfModule mod_php5.c&gt;
  php_flag engine off
&lt;/IfModule&gt;


I am using the DDEV environment to create docker containers on my local Ubuntu 10.04 VM (VirtualBox) on my Windows 10 PC. I use the DDEV default settings.php for Drupal 8. I then added the following lines:

// Config sync directory.
#$config_directories['sync']='sites/default';
$config_directories = array (
    CONFIG_SYNC_DIRECTORY =&gt; 'sites/default',
);

// Configure private file path
$settings['file_private_path']='sites/default/private';

// Configure trusted host patters to prevent HTTP HOST header attacks
$settings['trusted_host_patterns'] = [
    '^&lt;projectname&gt;\.ddev\.local$',
];


I have tried variations of the $config_directories definition including the commented out version. I also defined the sync directory to be 'sites/default/sync'. I have created the 'sites/default/sync' directory. I have tried deleting the config.tar.gz in the tmp directory which gives the log message 'The file tmp/config.tar.gz was not deleted because it does not exist.' and then creates the config.tar.gz file in the tmp directory.

I have tried find . -name *.tar.gz to search all the directories for any such files in case it has put it somewhere unexpected and no luck!

OK so for my versions:

Ubuntu 18.04, DDEV 0.18.0 (Nginx 1.14.0, PHP 7.1.16-1+0~20180405085551.16+jessie~1.gbp4937aa, Database 5.5.5-10.1.28-MariaDB ), Drupal 8.5.5. I have done these tests on a standard Drupal installation with the only additional module being Backup and Migrate 8.x-4.0. I have enabled a few of the core modules not enabled by the standard installation (e.g. Media).

There don't appear to be any messages in my latest Drupal error log for today (my most recent test of this bug).

Is there anything else I can supply that might help diagnose what I am doing wrong?
The best way to store configuration is to store it outside of Drupal root directory.

For example you will have next project structure:



Where:


config/sync is a directory with your sync configuration.
public_html is a directory with your Drupal 8.


In your setting.php just add this 

$config_directories['sync'] = '../config/sync';


And export your active configuration using drush

drush cex


That's all. In config/sync directory you will a files list of all your configuration.