Предупреждение: require_once (/var/www/html/wp-config.php): не удалось открыть поток: нет такого файла или каталога - PullRequest
0 голосов
/ 12 июня 2018

Я работал над следующей программой за последние 6 часов, используя предыдущий пост по этому вопросу, но безуспешно.В настоящее время я работаю над сайтом WP поверх котельной плиты Docker.Когда я запускаю 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

Не удается найти причину проблемы?

1 Ответ

0 голосов
/ 12 июня 2018

Тома в вашем файле docker-compose слишком специфичны - вам нужно предоставить саму монтируемую директорию / var / www / html, а не только wp-content или (ack!) Файл wp-config.php.

...