Adobe Commerce:配置文件缺失或更改

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

描述 description

环境

  • 云基础架构上的Adobe Commerce

问题/症状

配置文件config.php和/或env.php未正确更改或丢失。

解决方法 resolution

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

  • 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
experience-cloud-kcs-help-kbarticles