New WP install conflicts with DOCUMENT ROOT?

apps

#1

I recently upgraded my WordPress install (from 1.5.1.2 to 1.5.2) and suddenly my includes don’t work. I am also posting the problem to the WP forums, since logically it seems that it must be a WP configuration problem…

My includes looked like this (and still do on the non-WP portion of the site, working fine):

I tried using an absolute reference but can’t use “http://” because URL file-access is disabled in the server configuration. I don’t like that hack anyway.

Any ideas? Anyone else experiencing this?

BTW - the site I’m referring to is:
http://URL file-access is disabled in the server configuration in

mail[at]mahalie[dot]com


#2

You shouldn’t be trying to include files over HTTP protocol anyways if the files are in the same home directory even.

What you want to try is a file system pathname.

[pre]<?php include("/home/username/example.com/includes/top-nav.php"); ?>

And make sure /home/username/example.com/includes/top-nav.php exists. If that is not the correct path to that file, then simply edit the path in the call to include()

The url-file access this is a red herring - using a URL is not an “absolute reference”

For some reason it appears that people think the include() function accepts a URI as its parameter. It does not - read the PHP documentation. Its default parameter is a file system pathname, either absolute (beginning with a /) or relative.

Using an absolute URI (begins with scheme like http://) was a feature that when not used carefully makes your site vulnerable to exploits. There is no need to use it all if the files to be included are on the same computer and don’t need to be put through a separate HTTP transaction.

:cool: Perl / MySQL / HTML+CSS


#3

Thank You Atropos7!!

My level of PHP comprehension speaks for itself, I’m sure. Thank you for clarifying, using the file system path name worked.

I’m still curious to know why $DOCUMENT_ROOT suddenly stopped working but at least the problem is fixed.

I really should read the PHP documentation, it’s on my long, long list…but since I’m breaking things, well, sort of, I better bump it up.

mail[at]mahalie[dot]com


#4

$DOCUMENT_ROOT should actually be $_SERVER[‘DOCUMENT_ROOT’]. Maybe the current WP release is turning off register_globals?


If you want useful replies, ask smart questions.


#5

Say, that works too! You guys know your stuff. As if I wasn’t a dreamhost fanatic enough already…I’m cross posting all this info to a Wordpress thread so others can find it. Thanks again.

mail[at]mahalie[dot]com