配置文件缺失或更改

本文介绍如何解决配置文件被更改或丢失的问题。

受影响的产品和版本

  • 云基础架构上的Adobe Commerce,所有版本

问题

配置文件config.php和/或env.php被错误更改或丢失。

解决方案

部署过程将为每个配置文件创建一个备份文件:

  • app/etc/config.php.bak — 包含系统特定的设置,如果它不存在,则在生成期间自动生成
  • app/etc/env.php.bak — 包含敏感配置数据

您可以使用ECE-tools backup:restore命令恢复它们。

BAK文件是部署过程的产物。 如果在部署后手动更改配置文件,则您的更改不会反映在现有BAK文件中。

要恢复配置文件:

  1. 使用SSH登录到远程存储库。

  2. 列出可用的备份文件。

    code language-none
    ./vendor/bin/ece-tools backup:list
    
    code language-none
    The list of backup files:
    app/etc/env.php
    app/etc/config.php
    
  3. 恢复配置文件。

    code language-none
    ./vendor/bin/ece-tools backup:restore
    

    您会收到受恢复影响的现有配置文件的列表。

    code language-none
    app/etc/env.php file exists! If you want to rewrite existed files use --force
    app/etc/config.php file exists! If you want to rewrite existed files use --force
    
  4. 使用--force选项覆盖所有文件。

    code language-none
    ./vendor/bin/ece-tools backup:restore --force
    
    code language-none
    Command backup:restore with option --force will rewrite your existed files. Do you want to continue [y/N]?y
    Backup file app/etc/env.php was restored.
    Backup file app/etc/config.php was restored.
    
  5. 或者,您可以恢复特定的配置文件。

    code language-none
    ./vendor/bin/ece-tools backup:restore --force --file=app/etc/config.php
    
    code language-none
    Command backup:restore with option --force will rewrite your existed files. Do you want to continue [y/N]?y
    Backup file app/etc/config.php was restored.
    
recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a