File Path issue with Windows Server and IIS
-
My WordPress blog is working fine for the most part but I get a few errors in my log file in regard to file paths, I’m running WordPress on a Windows 2008 server and it seems the different file path characters on Windows and Unix are causing this, on Unix you use the forward slash “/” and on Windows you use the back slash “\” but need to use a double back slash to avoid the parse error of using the escape character – “\\”
So here’s the summary of my issue:
I’m running WordPress under IIS 7 in a FastCGI module PHP 5.2.9 environment and I have cgi.fix_pathinfo set to 1 in my php.ini
The errors that shows up in my log file read as follows:
Timestamp PHP Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(C:\PathtoWebServer\PathtoBlog\/C:\PathtoWebServer\PathtoBlog\/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack-en_US.mo) is not within the allowed path(s): (C:\PathtoWebServer\PathtoBlog\) in C:\PathtoWebServer\PathtoBlog\wp-includes\l10n.php on line 261
The other error is this one:
Timestamp PHP Warning: include(C:\PathtoWebServer\PathtoBlog/wp-content/themes/classic/searchform.php) [function.include]: failed to open stream: No such file or directory in C:\PathtoWebServer\PathtoBlog\wp-content\themes\classic\404.php on line 9
It’s obvious that the issue has to do with the use of the forward slash versus the back slash in the file path info.
I believe the issue has to do with file paths as set in the wp-settings.php file and the wp-config.php file.
To work around the first issue I edited the l10n.php file function as follows:
/**
* Loads MO file into the list of domains.
*
* If the domain already exists, the inclusion will fail. If the MO file is not
* readable, the inclusion will fail.
*
* On success, the mofile will be placed in the $l10n global by $domain and will
* be an gettext_reader object.
*
* @since 1.5.0
* @uses $l10n Gets list of domain translated string (gettext_reader) objects
* @uses CacheFileReader Reads the MO file
* @uses gettext_reader Allows for retrieving translated strings
*
* @param string $domain Unique identifier for retrieving translated strings
* @param string $mofile Path to the .mo file
* @return null On failure returns null and also on success returns nothing.
*/
function load_textdomain($domain, $mofile) {return;
/**
global $l10n;if ( is_readable($mofile))
$input = new CachedFileReader($mofile);
else
return;$gettext = new gettext_reader($input);
if (isset($l10n[$domain])) {
$l10n[$domain]->load_tables();
$gettext->load_tables();
$l10n[$domain]->cache_translations = array_merge($gettext->cache_translations, $l10n[$domain]->cache_translations);
} else
$l10n[$domain] = $gettext;unset($input, $gettext);
*/
}To work around the second issue I edited the wp-config file as follows:
Set
define('ABSPATH', dirname(__FILE__) . '/');
To
define('ABSPATH', 'C:\\PathtoWebServer\\PathtoBlog\\');
I don’t think this will solve the problem in the long term plus I’d also like to understand the issue more in depth. So if someone could explain to me what the fundamentals are for what’s going on here, please do. Also if you can point out where I can set a global WP configuration to replace the typical UNIX forward slash used in file paths with the Windows back slash and whether I’d have to set it to a double backslash in these global settings, please let me know that as well and anything else related to this.
Thanks
- The topic ‘File Path issue with Windows Server and IIS’ is closed to new replies.