Skip to content

Commit

Permalink
wp-env: Add phpMyAdmin and multisite support to the documentation (Wo…
Browse files Browse the repository at this point in the history
…rdPress#68125)

* wp-env: Added phpMyAdmin and multisite support to the documentation

* Fix double periods

Co-authored-by: Miguel Fonseca <[email protected]>

* Improve description of phpmyadminPort

Co-authored-by: Miguel Fonseca <[email protected]>

* Clarify explanation about phpMyAdmin and mysql ports

Co-authored-by: Miguel Fonseca <[email protected]>

* Add a line break

* Updated the description of phpMyAdmin

---------

Co-authored-by: t-hamano <[email protected]>
Co-authored-by: mcsf <[email protected]>
Co-authored-by: spacedmonkey <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
  • Loading branch information
5 people authored Jan 21, 2025
1 parent be5ce8a commit 39ed61d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ You can access the Dashboard at: `http://localhost:8888/wp-admin/` using **Usern

#### Accessing the MySQL Database

To access the MySQL database on the `wp-env` instance you will first need the connection details. To do this:
phpMyAdmin is available by default for the Gutenberg project. You can access the MySQL Database at: `http://localhost:9000/`.

If you want to access the database through another tool, you will first need the connection details. To do this:

1. In a terminal, navigate to your local Gutenberg repo.
2. Run `npm run wp-env start` - various information about the `wp-env` environment should be logged into the terminal.
Expand Down
34 changes: 21 additions & 13 deletions packages/env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,17 +479,19 @@ You can customize the WordPress installation, plugins and themes that the develo

`.wp-env.json` supports fields for options applicable to both the tests and development instances.

| Field | Type | Default | Description |
|----------------|----------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| `"core"` | `string\|null` | `null` | The WordPress installation to use. If `null` is specified, `wp-env` will use the latest production release of WordPress. |
| `"phpVersion"` | `string\|null` | `null` | The PHP version to use. If `null` is specified, `wp-env` will use the default version used with production release of WordPress. |
| `"plugins"` | `string[]` | `[]` | A list of plugins to install and activate in the environment. |
| `"themes"` | `string[]` | `[]` | A list of themes to install in the environment. |
| `"port"` | `integer` | `8888` (`8889` for the tests instance) | The primary port number to use for the installation. You'll access the instance through the port: 'http://localhost:8888'. |
| `"testsPort"` | `integer` | `8889` | The port number for the test site. You'll access the instance through the port: 'http://localhost:8889'. |
| `"config"` | `Object` | See below. | Mapping of wp-config.php constants to their desired values. |
| `"mappings"` | `Object` | `"{}"` | Mapping of WordPress directories to local directories to be mounted in the WordPress instance. |
| `"mysqlPort"` | `integer` | `null` (randomly assigned) | The MySQL port number to expose. The setting is only available in the `env.development` and `env.tests` objects. |
| Field | Type | Default | Description |
|--------------------|----------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| `"core"` | `string\|null` | `null` | The WordPress installation to use. If `null` is specified, `wp-env` will use the latest production release of WordPress. |
| `"phpVersion"` | `string\|null` | `null` | The PHP version to use. If `null` is specified, `wp-env` will use the default version used with production release of WordPress. |
| `"plugins"` | `string[]` | `[]` | A list of plugins to install and activate in the environment. |
| `"themes"` | `string[]` | `[]` | A list of themes to install in the environment. |
| `"port"` | `integer` | `8888` (`8889` for the tests instance) | The primary port number to use for the installation. You'll access the instance through the port: 'http://localhost:8888'. |
| `"testsPort"` | `integer` | `8889` | The port number for the test site. You'll access the instance through the port: 'http://localhost:8889'. |
| `"config"` | `Object` | See below. | Mapping of wp-config.php constants to their desired values. |
| `"mappings"` | `Object` | `"{}"` | Mapping of WordPress directories to local directories to be mounted in the WordPress instance. |
| `"mysqlPort"` | `integer` | `null` (randomly assigned) | The MySQL port number to expose. The setting is only available in the `env.development` and `env.tests` objects. |
| `"phpmyadminPort"` | `integer` | `null` | The port number for phpMyAdmin. If provided, you'll access phpMyAdmin through: http://localhost:<port> |
| `"multisite"` | `boolean` | `false` | Whether to set up a multisite installation. |

_Note: the port number environment variables (`WP_ENV_PORT` and `WP_ENV_TESTS_PORT`) take precedent over the .wp-env.json values._

Expand Down Expand Up @@ -523,7 +525,8 @@ Additionally, the key `env` is available to override any of the above options on
"KEY_1": false
},
"port": 3000,
"mysqlPort": 13306
"mysqlPort": 13306,
"phpmyadminPort": 9001
}
}
}
Expand Down Expand Up @@ -688,7 +691,12 @@ You can tell `wp-env` to use a custom port number so that your instance does not
}
```

These can also be set via the environment variables `WP_ENV_PORT`, `WP_ENV_TESTS_PORT`, `WP_ENV_MYSQL_PORT` and `WP_ENV_TESTS_MYSQL_PORT`.
These can also be set via environment variables:

- `WP_ENV_PORT` to override the development environment's web server's port.
- `WP_ENV_TESTS_PORT` to override the testing environment's web server's port.
- phpMyAdmin is not enabled by default, but its port can also be overridden for the development and testing environments via `WP_ENV_PHPMYADMIN_PORT` and `WP_ENV_TESTS_PHPMYADMIN_PORT`, respectively.
- By default, MySQL aren't exposed to the host, which means no chance of port conflicts. But these can also be overridden for the development and testing environments via `WP_ENV_MYSQL_PORT` and `WP_ENV_TESTS_MYSQL_PORT`, respectively.

### Specific PHP Version

Expand Down

0 comments on commit 39ed61d

Please sign in to comment.