Support » Fixing WordPress » 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() []: open_basedir restriction in effect. File(C:\PathtoWebServer\PathtoBlog\/C:\PathtoWebServer\PathtoBlog\/wp-content/plugins/all-in-one-seo-pack/ 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) {

    global $l10n;

    if ( is_readable($mofile))
    $input = new CachedFileReader($mofile);

    $gettext = new gettext_reader($input);

    if (isset($l10n[$domain])) {
    $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.


Viewing 3 replies - 1 through 3 (of 3 total)
  • I am having the EXACT same issue using IIS7 on Windows 2008. It started along with the WP 2.8 version.

    The site appears ok though, but I get lots of concerning warnings too:

    PHP Warning: is_readable() []: open_basedir restriction in effect. File(C:\wwwroot\\www/C:\wwwroot\\www/wp-content/plugins/all-in-one-seo-pack/ is not within the allowed path(s): (C:\SITES) in C:\wwwroot\\www\wp-includes\l10n.php on line 324 PHP Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(C:\wwwroot\\www/wp-content/plugins/edit-tags.php?taxonomy=post_tag) is not within the allowed path(s): (C:\wwwroot) in C:\wwwroot\\www\wp-admin\menu-header.php on line 118

    I have a client how is having the same problems. I am unable to upload any file or update the blog from wordpress due to this issue.

    I was hoping to find a plugin that would fix this issue.

    How have you guys got a long all this time?

    I’ve been having the same issue with the google sitemap plugin.

    The hack above worked, but obviously, not the best model.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘File Path issue with Windows Server and IIS’ is closed to new replies.