|
| 1 | +wp-cli/config-command |
| 2 | +===================== |
| 3 | + |
| 4 | +Manage the wp-config.php file. |
| 5 | + |
| 6 | +[](https://travis-ci.org/wp-cli/config-command) |
| 7 | + |
| 8 | +Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) |
| 9 | + |
| 10 | +## Using |
| 11 | + |
| 12 | +This package implements the following commands: |
| 13 | + |
| 14 | +### wp config |
| 15 | + |
| 16 | +Manage the wp-config.php file |
| 17 | + |
| 18 | +~~~ |
| 19 | +wp config |
| 20 | +~~~ |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +### wp config create |
| 27 | + |
| 28 | +Generate a wp-config.php file. |
| 29 | + |
| 30 | +~~~ |
| 31 | +wp config create --dbname=<dbname> --dbuser=<dbuser> [--dbpass=<dbpass>] [--dbhost=<dbhost>] [--dbprefix=<dbprefix>] [--dbcharset=<dbcharset>] [--dbcollate=<dbcollate>] [--locale=<locale>] [--extra-php] [--skip-salts] [--skip-check] [--force] |
| 32 | +~~~ |
| 33 | + |
| 34 | +Creates a new wp-config.php with database constants, and verifies that |
| 35 | +the database constants are correct. |
| 36 | + |
| 37 | +**OPTIONS** |
| 38 | + |
| 39 | + --dbname=<dbname> |
| 40 | + Set the database name. |
| 41 | + |
| 42 | + --dbuser=<dbuser> |
| 43 | + Set the database user. |
| 44 | + |
| 45 | + [--dbpass=<dbpass>] |
| 46 | + Set the database user password. |
| 47 | + |
| 48 | + [--dbhost=<dbhost>] |
| 49 | + Set the database host. |
| 50 | + --- |
| 51 | + default: localhost |
| 52 | + --- |
| 53 | + |
| 54 | + [--dbprefix=<dbprefix>] |
| 55 | + Set the database table prefix. |
| 56 | + --- |
| 57 | + default: wp_ |
| 58 | + --- |
| 59 | + |
| 60 | + [--dbcharset=<dbcharset>] |
| 61 | + Set the database charset. |
| 62 | + --- |
| 63 | + default: utf8 |
| 64 | + --- |
| 65 | + |
| 66 | + [--dbcollate=<dbcollate>] |
| 67 | + Set the database collation. |
| 68 | + --- |
| 69 | + default: |
| 70 | + --- |
| 71 | + |
| 72 | + [--locale=<locale>] |
| 73 | + Set the WPLANG constant. Defaults to $wp_local_package variable. |
| 74 | + |
| 75 | + [--extra-php] |
| 76 | + If set, the command copies additional PHP code into wp-config.php from STDIN. |
| 77 | + |
| 78 | + [--skip-salts] |
| 79 | + If set, keys and salts won't be generated, but should instead be passed via `--extra-php`. |
| 80 | + |
| 81 | + [--skip-check] |
| 82 | + If set, the database connection is not checked. |
| 83 | + |
| 84 | + [--force] |
| 85 | + Overwrites existing files, if present. |
| 86 | + |
| 87 | +**EXAMPLES** |
| 88 | + |
| 89 | + # Standard wp-config.php file |
| 90 | + $ wp core config --dbname=testing --dbuser=wp --dbpass=securepswd --locale=ro_RO |
| 91 | + Success: Generated 'wp-config.php' file. |
| 92 | + |
| 93 | + # Enable WP_DEBUG and WP_DEBUG_LOG |
| 94 | + $ wp core config --dbname=testing --dbuser=wp --dbpass=securepswd --extra-php <<PHP |
| 95 | + $ define( 'WP_DEBUG', true ); |
| 96 | + $ define( 'WP_DEBUG_LOG', true ); |
| 97 | + $ PHP |
| 98 | + Success: Generated 'wp-config.php' file. |
| 99 | + |
| 100 | + # Avoid disclosing password to bash history by reading from password.txt |
| 101 | + $ wp core config --dbname=testing --dbuser=wp --prompt=dbpass < password.txt |
| 102 | + Success: Generated 'wp-config.php' file. |
| 103 | + |
| 104 | +## Installing |
| 105 | + |
| 106 | +Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with `wp cli update`. |
| 107 | + |
| 108 | +Once you've done so, you can install this package with `wp package install wp-cli/config-command`. |
| 109 | + |
| 110 | +## Contributing |
| 111 | + |
| 112 | +We appreciate you taking the initiative to contribute to this project. |
| 113 | + |
| 114 | +Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation. |
| 115 | + |
| 116 | +### Reporting a bug |
| 117 | + |
| 118 | +Think you’ve found a bug? We’d love for you to help us get it fixed. |
| 119 | + |
| 120 | +Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/config-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version. |
| 121 | + |
| 122 | +Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/config-command/issues/new) with the following: |
| 123 | + |
| 124 | +1. What you were doing (e.g. "When I run `wp post list`"). |
| 125 | +2. What you saw (e.g. "I see a fatal about a class being undefined."). |
| 126 | +3. What you expected to see (e.g. "I expected to see the list of posts.") |
| 127 | + |
| 128 | +Include as much detail as you can, and clear steps to reproduce if possible. |
| 129 | + |
| 130 | +### Creating a pull request |
| 131 | + |
| 132 | +Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/config-command/issues/new) to discuss whether the feature is a good fit for the project. |
| 133 | + |
| 134 | +Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience: |
| 135 | + |
| 136 | +1. Create a feature branch for each contribution. |
| 137 | +2. Submit your pull request early for feedback. |
| 138 | +3. Include functional tests with your changes. [Read the WP-CLI documentation](https://wp-cli.org/docs/pull-requests/#functional-tests) for an introduction. |
| 139 | +4. Follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/). |
| 140 | + |
| 141 | + |
| 142 | +*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.* |
0 commit comments