Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
timnolte opened this issue Feb 22, 2024 · 2 comments

Comments

@timnolte
Copy link

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;
		}
@gmazzap
Copy link
Member

gmazzap commented Feb 22, 2024

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

@timnolte
Copy link
Author

timnolte commented Feb 22, 2024

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants