[wp-trac] Re: [WordPress Trac] #10234: Incorrect 'siteurl' inserted
into database
WordPress Trac
wp-trac at lists.automattic.com
Tue Jun 23 01:06:50 GMT 2009
#10234: Incorrect 'siteurl' inserted into database
-----------------------------+----------------------------------------------
Reporter: SteveBooth | Owner: dd32
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.8.1
Component: Upgrade/Install | Version:
Severity: blocker | Keywords:
-----------------------------+----------------------------------------------
Comment(by SteveBooth):
I figured it out, and it's REALLY arcane. Get some Coke.. this is going
to take a bit.
When the root index.php file runs, it requires blog-header.php. When this
runs, it requires 'template-loader.php. Line 7 in 'template-loader.php'
which is very nearly the first thing this module does is:
do_action('template_redirect');
This calls 'redirect_canonical' in canonical.php. No $args have been set
up for the template_redirect and the $requested_url parameter to this
function is null.
This causes the following code, on line 45, to execute:
if ( !$requested_url ) {
// build the URL in the address bar
$requested_url = ( !empty($_SERVER['HTTPS'] ) &&
strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' :
'http://';
$requested_url .= $_SERVER['HTTP_HOST'];
$requested_url .= $_SERVER['REQUEST_URI'];
}
And herein lies the problem. My site is hosted on a Concentric Unix
server. PHPInfo returns the following:
PHP Version 4.4.8
System: SunOS www.stevenmbooth.com 5.10 VDE sun4v
(MySQL is 4.1.22, but it's not germaine here)
And here's the bottom line. My wordpress home directory is
'http://www.stevenmbooth.com/wordpress'. $_SERVER['HTTP_HOST'], above,
returns 'www.stevenmbooth.com' and '$_SERVER['REQUEST_URI']' returns null,
and this produces The INCORRECT PATH.
These results cause the above code to construct the url
'http://www.stevenmbooth.com' as the redirect URL, and the browser
immediately redirects to my root page, which causes my old index.html web
site to initialize (I'm installing the WP site in the directory
stevenmbooth.com/wordpress'.
SO... Either that redirect line at the beginning of template_loader is
completely wrong (doubtful), or we need to use something other than
HTTP_HOST to detect the root directory for WP (see http://www.nabble.com
/When-HTTP_HOST-does-not-point-to-the-blog-td18097138.html ).
OH.. and I do believe this is a problem in 2.8.x as well, and that's why
2.8.x doesn't work for me.
So, you see, the problem was actually with WP's interaction with my Apache
server, and not my site or my templates.
The question is... what do we do to fix this? What's the right way to
detect the home install directory for WP? Assuming it's HTTP_HOST seems
to be incorrect, here.
Geez. I wish I could charge you for the 12 hours it's taken me to find
this.
:)
Steve
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10234#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list