move_db_last_error_to_cachedir

As of 2.1, we want to store db_last_error.php in the cache To make that happen, Settings.php needs to ensure the $cachedir path is correct before trying to write to db_last_error.php