WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 22 months ago

#33119 closed enhancement (invalid)

custom location for wp-config.php

Reported by: igor.bukanov Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Bootstrap/Load Keywords:
Focuses: Cc:

Description

I use the same shared read-only wordpress installation for several sites. To allow site customization wp-config.php stored in the shared folder contains a single line:

require $_SERVER['WP_CONFIG'];

where WP_CONFIG is defined in the web server configuration for the site.

Would it be possible to add a check for $_SERVER['WP_CONFIG'] to wordpress itself?

This way I could, for example, just use git to pull wordpress updates from github without a need for a custom branch with wp-config.php defined. Another nice possibility is simplified atomic updates for the site. That is, I could just unpack wordpress tar into a new directory and call renameat2(..., RENAME_EXCHANGE) without the need to create first the above wp-config.php in the unpacked archive.

Change History (5)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to Bootstrap/Load

#2 follow-up: @dd32
5 years ago

I don't think this is something we should support personally.

Currently you've got two locations you can place the wp-config.php file:

  • ABSPATH (ie. public_html/mysite.com/)
  • One level above (ie. public_html/ )

The wp-config.php file that exists there, simply needs to exist, it doesn't need to actually contain the directives - you could simply have the contents as <?php require $_SERVER['WP_CONFIG'];

Last edited 5 years ago by dd32 (previous) (diff)

#3 in reply to: ↑ 2 ; follow-up: @igor.bukanov
5 years ago

Replying to dd32:

The wp-config.php file that exists there, simply needs to exist, it doesn't need to actually contain the directives - you could simply have the contents as <?php require $_SERVER['WP_CONFIG'];

This is what I have currently in my setup. The issue is that it complicates the update process. I cannot just have a pristine git tree cloned from github with official wordpress distribution. I have to have a custom branch containing wp-config.php on top of it. Similarly, I cannot just extract distribution tar into a directory and then atomically swap it with the current install. I have to copy wp-config.php there first.

#4 in reply to: ↑ 3 @SergeyBiryukov
5 years ago

Replying to igor.bukanov:

Similarly, I cannot just extract distribution tar into a directory and then atomically swap it with the current install. I have to copy wp-config.php there first.

The wp-config.php file doesn't necessarily need to be in the same directory, it can be one level up.

#5 @chriscct7
22 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Closing as initially reported need for this ticket is not valid -- closing as invalid as such.

Note: See TracTickets for help on using tickets.