php - 警告:require_once(/var/www/html/wp-config.php):无法打开流:没有这样的文件或目录

标签 php wordpress docker docker-compose

在过去的6个小时中,我一直在使用下面的文章来研究以下程序,但没有成功。我目前正在Docker样板之上的WP网站上工作。当我运行docker-compose up并导航到localhost:8080时,出现以下错误:

enter image description here

在服务器端,我收到以下警告:

mysql_1       | 2018-06-12T20:03:03.976722Z 0 [Note] mysqld: ready for connections.
mysql_1       | Version: '5.7.22'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
wordpress_1   | WordPress not found in /var/www/html - copying now...
wordpress_1   | WARNING: /var/www/html is not empty - press Ctrl+C now if this is an error!

wp-load.php:
/** Define ABSPATH as this file's directory */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}

error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );

/*
 * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
 * doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
 * of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
 * and /blog/ is WordPress(b).
 *
 * If neither set of conditions is true, initiate loading the setup process.
 */
if ( file_exists( ABSPATH . 'wp-config.php') ) {

    /** The config file resides in ABSPATH */
    require_once( ABSPATH . 'wp-config.php' );

} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {

    /** The config file resides one level above ABSPATH but is not part of another installation */
    require_once( dirname( ABSPATH ) . '/wp-config.php' );

} else {

    // A config file doesn't exist

    define( 'WPINC', 'wp-includes' );
    require_once( ABSPATH . WPINC . '/load.php' );

    // Standardize $_SERVER variables across setups.
    wp_fix_server_vars();

    require_once( ABSPATH . WPINC . '/functions.php' );

    $path = wp_guess_url() . '/wp-admin/setup-config.php';

    /*
     * We're going to redirect to setup-config.php. While this shouldn't result
     * in an infinite loop, that's a silly thing to assume, don't you think? If
     * we're traveling in circles, our last-ditch effort is "Need more help?"
     */
    if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
        header( 'Location: ' . $path );
        exit;
    }

docker-compose.yml
wordpress: # name of our wordpress container
    depends_on: # container dependencies that need to be running first
      - mysql
    # image: wordpress:latest # image used by our container
    image: wordpress:4.9.6-php7.0 # image used by our container
    ports:
      - "8080:80" # setting our ports for networking
    restart: always
    volumes: # this is where we tell Docker what to pay attention to
      - ./app/wp-content:/var/www/html/wp-content # mapping our custom theme to the container
      - ./app/wp-config.php:/var/www/html/wp-config.php # map our plugins to the container
    networks:
      - back

似乎找不到问题所在?

最佳答案

docker-compose文件中的卷太具体了-您需要公开/ var / www / html目录安装本身,而不仅仅是wp-content或wp-config.php文件。

关于php - 警告:require_once(/var/www/html/wp-config.php):无法打开流:没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50825325/

相关文章:

php - 添加过滤器以将类添加到 WordPress 中的标记链接

docker - 如何在带有alpine base的dockerfile中使用超时?

php - 验证数据库中是否存在电子邮件时遇到问题

php - 使用 REST API 将媒体上传到 WordPress

php - CakePHP 复选框 - 忽略未选中的复选框

mysql - 重新编号 WordPress 博客中的类别

php - mysql 连接 symfony + docker

python - 运行时错误 : Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment

php - 如何使用 PHP [MWS] 将产品从 CSV 文件导出到亚马逊商店?

javascript - easyui 添加整列