When try use this command:

php wp-cli.phar core install --url="http://example.com"

the command fails. WordPress was installed, but WP CLI complains about an invalid siteurl and home because I have installed WordPress inside http://example.com/project-root.

But if I try use by alias wp (wp core install --url="http://example.com") all is ok and url is valid.

What's wrong with the previous command?

1 Answer 1


Short answer: Read the documentation.

Long answer: WP CLI needs to know your WordPress root directory. That is not platform, but software specific. This is also needed in Multisite and Network installs to determine the current site.

The easiest way to solve this is to use a YAML configuration file for WP CLI. Best is to place this in your users home directory so WP CLI searches from the root and upwards for it and uses the options provided there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.