From 82dc2aad6d2b709ec62a5c5fb4c6f702643748ee Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 4 Apr 2025 22:59:03 +0800 Subject: [PATCH] Updated WP Installer Command --- scripts/install-wordpress.sh | 40 +++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/scripts/install-wordpress.sh b/scripts/install-wordpress.sh index d41ad53..7faa301 100644 --- a/scripts/install-wordpress.sh +++ b/scripts/install-wordpress.sh @@ -238,19 +238,18 @@ fi # Create wp-config.php with the new database credentials echo -e "${YELLOW}Creating wp-config.php...${NC}" -wp config create \ - --dbname="$DB_NAME" \ - --dbuser="$DB_USER" \ - --dbpass="$DB_PASSWORD" \ - --dbhost="$DB_HOST" \ - --allow-root +echo -e "${YELLOW}Attempting to use WP-CLI to create config with these parameters:${NC}" +echo -e "Database: $DB_NAME" +echo -e "User: $DB_USER" +echo -e "Password: $DB_PASSWORD" +echo -e "Host: $DB_HOST" -# Verify that wp-config.php was created successfully -if [ ! -f "wp-config.php" ]; then - echo -e "${RED}Failed to create wp-config.php. Attempting alternative method...${NC}" +# Try to create wp-config.php with WP-CLI first (with error output captured) +wp config create --dbname="$DB_NAME" --dbuser="$DB_USER" --dbpass="$DB_PASSWORD" --dbhost="$DB_HOST" --allow-root --debug || { + echo -e "${RED}WP-CLI config create failed. Error code: $?${NC}" - # Try alternative method using direct file creation - echo -e "${YELLOW}Attempting to create wp-config.php manually...${NC}" + # Create wp-config.php manually regardless of whether WP-CLI command succeeded + echo -e "${YELLOW}Creating wp-config.php manually as a fallback...${NC}" cat > wp-config.php <