Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //...
- // This will usually be received from an env variable, for example $connectionString = getenv('DB_URL');
- $connectionString = 'mysql://user:password@foo-bar.rds.amazonaws.com:3306/database';
- // The values below will be your default values if $connectionString is empty.
- $dbConfig = array_merge(
- [
- 'host' => 'localhost',
- 'port' => 3306,
- 'user' => 'root',
- 'pass' => '',
- 'path' => 'wp', // DB_NAME
- ],
- array_filter(parse_url($connectionString))
- );
- /** The name of the database for WordPress */
- define('DB_NAME', ltrim($dbConfig['path'], '/'));
- /** MySQL database username */
- define('DB_USER', $dbConfig['user']);
- /** MySQL database username */
- define('DB_PASSWORD', $dbConfig['pass']);
- /** MySQL hostname */
- define('DB_HOST', "{$dbConfig['host']}:{$dbConfig['port']}");
- //...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement