File path problems
-
I’m using Relocate Upload 0.22. I’m trying to get it running on my test server, which is IIS7 on Vista. My server contains more than one site, each a subfolder under
C:\inetpub\wwwroot
. Let’s call one I’m trying to set it up on isC:\inetpub\wwwroot\mysite
.When I first installed the plugin, the settings page said:
Paths are relative to your blog's root folder: C:\inetpub\wwwroot Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(C:\inetpub\wwwrootc:\inetpub\wwwroot\mysite/wp-content/uploads) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\mysite\wp-content\plugins\relocate-upload\relocate-upload.php on line 247 Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(C:\inetpub\wwwrootc:) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\mysite\wp-content\plugins\relocate-upload\relocate-upload.php on line 247
I edited relocate-upload.php line 12 to be:
define('SERVER_DOC_ROOT', $GLOBALS['_SERVER']['DOCUMENT_ROOT'].'/mysite/');
The result:Paths are relative to your blog's root folder: C:\inetpub\wwwroot/gbotd/ Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(C:\inetpub\wwwroot/gbotd/c:\inetpub\wwwroot\gbotd/wp-content/uploads) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\gbotd\wp-content\plugins\relocate-upload\relocate-upload.php on line 251 Warning: mkdir() [function.mkdir]: Invalid argument in c:\inetpub\wwwroot\gbotd\wp-content\plugins\relocate-upload\relocate-upload.php on line 251
Line 251 is:
f(!file_exists($new_dir)) mkdir( $new_dir, 0755, true );
— it’s slightly different from the original because I’ve added some comments as I’m working.Looking at the first error message, I decided to try changing line 248:
$new_dir = SERVER_DOC_ROOT . replace_month_year( $ru_folder['path'], date("Y-m") );
to:
$new_dir = replace_month_year( $ru_folder['path'], date("Y-m") );
Now I get:
Paths are relative to your blog's root folder: C:\inetpub\wwwroot/gbotd/ Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File() is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\mysite\wp-content\plugins\relocate-upload\relocate-upload.php on line 251 new location
The Default location form seems to be displaying properly.
So, some of this seems to be related to an open_basedir problem — particularly frustrating because it seems to be turned off in php.ini.
But as for the rest, it looks to me as though something similar to what’s described in the comment at the end of the program is happening:
// thing is if you have an absolute path to your file, WP will give you an url like // https://domain.co.uk/path_to/wp-content/uploads//home/useraccount/public_html/another_path_to/media/media_item.gif // note the double / // // as SERVER_DOC_ROOT = /home/useraccount/public_html // // we do a search for (https://.*?/).*?/SERVER_DOC_ROOT/ and replace with \1
but the fix isn’t working.
— Red Owl Web Design
- The topic ‘File path problems’ is closed to new replies.