Skip to content

When using with the DDev tool WP Starter v3 doesn't recognize WP_HOME as being set #135

Open

Description

@timnolte

if (!defined('WP_HOME')) {
$port = is_numeric($_SERVER['SERVER_PORT'] ?? '') ? (int)$_SERVER['SERVER_PORT'] : 0;
$scheme = isset($_SERVER['HTTPS'])
? (filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN) ? 'https' : 'http')
: ($port === 443 ? 'https' : 'http');
$home = "{$scheme}://";
$home .= $_SERVER['SERVER_NAME'] ?? 'localhost';
$ports = ['https' => 443, 'http' => 80];
(($port > 0) && ($port !== $ports[$scheme])) and $home .= sprintf(':%d', $port);
define('WP_HOME', $home);
unset($port, $scheme, $home, $ports);
}

This file: https://github.com/ddev/ddev/blob/master/pkg/ddevapp/wordpress/wp-config-ddev.php

is being included in the ENV_VARIABLES section as so:

		// Include for ddev-managed settings in wp-config-ddev.php.
		$ddev_settings = dirname( __FILE__ ) . '/wp-config-ddev.php';
		if ( is_readable( $ddev_settings ) && ! defined( 'DB_USER' ) ) {
			require_once $ddev_settings;
		}

Activity

  1. gmazzap commented on Feb 22, 2024

    @gmazzap
    Member

    @timnolte first basic question, have you verified that getenv('IS_DDEV_PROJECT') returns "true" when the faile is loaded?

  2. timnolte commented on Feb 22, 2024

    @timnolte
    Author

    @gmazzap well, so here's the thing, if we manually setup on line 225:

    $home .= $_SERVER['SERVER_NAME'] ?? '<PROJECT_ID>.ddev.site';

    The site loads properly along with all of the database settings. It would seem to me then that URL_CONSTANTS is being loaded before ENV_VARIABLES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions