0

I'm installing Wordpress with wp-cli. The installation works without failure but it's setting siteurl and home to http://cbdhut.homehome. The command I'm running to install are:

cd ${webroot}
./wp.phar core download
./wp.phar config create --dbname="${db_name}" --dbuser="${db_username}" --dbpass="${db_password}" --dbhost="${db_host}"
./wp.phar db create
./wp.phar core install --url=http://cbdhut.home/ --title="Test Blog" --admin_user="admin" --admin_password="passw0rd" --admin_email="test@cbdhut.home"

Any ideas why this might be happening? I've tried using the nightly build of wp-cli and the issue remains. I've also tried setting --url to cbdhut.home (without the protocol) and the same problem happens.

I have the code in a provision script that runs as unprivileged user:

# Permissions
chown "${user}":www-data "${webroot}"

# Install Wordpress
sudo -u "${user}" bash -s <<ILOVEBASH
export WP_CLI_CACHE_DIR=${webroot}

cd ${webroot}

curl -sO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
mv wp-cli-nightly.phar wp.phar
chmod +x ${webroot}/wp.phar

./wp.phar core download
./wp.phar config create --dbname="${db_name}" --dbuser="${db_username}" --dbpass="${db_password}" --dbhost="${db_host}"
./wp.phar db create
./wp.phar core install --url=cbdhut.home --title="Test Blog" --admin_user="admin" --admin_password="pass0rd" --admin_email="test@cbdhut.home"

#./wp.phar plugin install https://github.com/wp-plugins/akismet/archive/master.zip --force
#./wp.phar plugin install https://github.com/Yoast/wordpress-seo/archive/trunk.zip --force

#./wp.phar plugin update --all
ILOVEBASH

Any ideas?

Edit

It seems to be happening during the db create call because if I run the following command there's a few places where it has this odd looking URL:

$ ./wp.phar search-replace --dry-run 'cbdhut.homehome' 'cbdhut.home'
+------------------+-----------------------+--------------+------+
| Table            | Column                | Replacements | Type |
+------------------+-----------------------+--------------+------+
| wp_commentmeta   | meta_key              | 0            | SQL  |
| wp_commentmeta   | meta_value            | 0            | SQL  |
| wp_comments      | comment_author        | 0            | SQL  |
| wp_comments      | comment_author_email  | 0            | SQL  |
| wp_comments      | comment_author_url    | 0            | SQL  |
| wp_comments      | comment_author_IP     | 0            | SQL  |
| wp_comments      | comment_content       | 0            | SQL  |
| wp_comments      | comment_approved      | 0            | SQL  |
| wp_comments      | comment_agent         | 0            | SQL  |
| wp_comments      | comment_type          | 0            | SQL  |
| wp_links         | link_url              | 0            | SQL  |
| wp_links         | link_name             | 0            | SQL  |
| wp_links         | link_image            | 0            | SQL  |
| wp_links         | link_target           | 0            | SQL  |
| wp_links         | link_description      | 0            | SQL  |
| wp_links         | link_visible          | 0            | SQL  |
| wp_links         | link_rel              | 0            | SQL  |
| wp_links         | link_notes            | 0            | SQL  |
| wp_links         | link_rss              | 0            | SQL  |
| wp_options       | option_name           | 0            | SQL  |
| wp_options       | option_value          | 2            | PHP  |
| wp_options       | autoload              | 0            | SQL  |
| wp_postmeta      | meta_key              | 0            | SQL  |
| wp_postmeta      | meta_value            | 0            | SQL  |
| wp_posts         | post_content          | 2            | SQL  |
| wp_posts         | post_title            | 0            | SQL  |
| wp_posts         | post_excerpt          | 0            | SQL  |
| wp_posts         | post_status           | 0            | SQL  |
| wp_posts         | comment_status        | 0            | SQL  |
| wp_posts         | ping_status           | 0            | SQL  |
| wp_posts         | post_password         | 0            | SQL  |
| wp_posts         | post_name             | 0            | SQL  |
| wp_posts         | to_ping               | 0            | SQL  |
| wp_posts         | pinged                | 0            | SQL  |
| wp_posts         | post_content_filtered | 0            | SQL  |
| wp_posts         | guid                  | 3            | SQL  |
| wp_posts         | post_type             | 0            | SQL  |
| wp_posts         | post_mime_type        | 0            | SQL  |
| wp_term_taxonomy | taxonomy              | 0            | SQL  |
| wp_term_taxonomy | description           | 0            | SQL  |
| wp_termmeta      | meta_key              | 0            | SQL  |
| wp_termmeta      | meta_value            | 0            | SQL  |
| wp_terms         | name                  | 0            | SQL  |
| wp_terms         | slug                  | 0            | SQL  |
| wp_usermeta      | meta_key              | 0            | SQL  |
| wp_usermeta      | meta_value            | 0            | PHP  |
| wp_users         | user_login            | 0            | SQL  |
| wp_users         | user_nicename         | 0            | SQL  |
| wp_users         | user_email            | 0            | SQL  |
| wp_users         | user_url              | 0            | SQL  |
| wp_users         | user_activation_key   | 0            | SQL  |
| wp_users         | display_name          | 0            | SQL  |
+------------------+-----------------------+--------------+------+
  • Did you check if this is a problem with the TLD .home? (In other words: Does the same problem, when you try to set it to example.com?) – kero Jan 27 at 16:29
  • Same problem tried with .co.uk and got: cbdhut.co.ukco.uk. – BugHunterUK Jan 28 at 2:33
  • Did you try --url="cbdhut.home"? – BenB Jan 28 at 3:30
  • @BenB yeah tried that. I did mention that in the question. I've since now changed to using a config.yml file and the problem is still happening. I'm at the point now of trying to find the code in the wp-cli repo to see how it's adding the domain to the database. – BugHunterUK Jan 28 at 3:46
  • What does error log show? – BenB Jan 28 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.