Page MenuHomePhabricator

IIS File Not Found Issue due to permissions (problem identified)
Closed, InvalidPublic

Description

Author: randyest1

Description:
Installed Mediawiki on IIS just fine. Skinned it. Went to upload file, got a 500 internal server error. Triple checked everything, ends up being the file permissions on the images folder.

So, went into the server and changed the file permissions on the images folder, and the subfolders therein.

Here's the catch: the file permissions on the newly created subfolders are all denied all permissions for IUSR_****. I tried setting what I think is the folder creation function to 0777 permissions rather than a variable, no luck.

So, I'm not an IIS guy (client wanted this specifically).

I can go in and set the permissions on the folder each time they upload an image manually on the server (then it works just fine), but that's counterproductive. I've found a few pages with a similar bug floating around google. I've managed to identify the sub-folder-creation issue, but don't know how to fix it for IIS.

HELP!

Thanks


Version: 1.18.x
Severity: major

Details

Reference
bz35890

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:13 AM
bzimport set Reference to bz35890.
bzimport added a subscriber: Unknown Object (MLST).

Bugzilla isn't really a support fourm...

500 error would usually mean php fatal error (Which should not happen on permission error). Please enable error logging on php, and tell us what the actual error message is.

Bryan.TongMinh wrote:

Presumably we need some Windows-specific magic in wfMkDirParents() or whatever that function is called.

randyest1 wrote:

It's an accessed denied error for sure, though I agree it's odd that it presents this way.

How would I enable php errors? I have this is a subfolder (/wiki/) none of the errors are showing up in my root error_log and I don't see any other error_log files in the /wiki/ folder or subfolders.

It's definitely an access issue. I upload the file successfully, but I can't view it. I go into the images folder, set all children to have full access permissions, and then I can view it. It needs to have the correct permissions in IIS, and I do believe that it falls under bugs, just happens to be one that I have an immediate need to have fixed.

Essentially, the wfMkdirParents function in GlobalFunctions.php needs to have the mkdir function changed, or the $mode variable changed, when using IIS. The folders it is creating do not have the correct permissions, even with the /images/ directory set explicitly to recurs permissions to all children. I'd change it myself, but I simply do not have the experience with the PHP/ISS mix to get the permissions set using PHP. In php/apache or .net/iis this is a simple function. I couldn't find ANYTHING useful on the web about how to override permissions using php on iis.

As I've found this "bug" unresolved on other forums, and with a much less clear identification of the "bug", I thought it would be proactive to post it here. Ideally, a conditional for iis folder creation vs apache folder creation in future versions will clear this up.

randyest1 wrote:

Bryan, yes, in a nutshell I believe you're right.

randyest1 wrote:

After much poking and hair pulling:

We had to create an all-encompassing user and assign them all permissions in C:/windows/temp/

Also, we disabled the sub-directory saving for images, so that they are all saved directly in the default /images/ folder.

If there's a way around this, that'd be great, it's probably not good for security, but for now we can get our images working.

Thanks

(In reply to comment #3)

Essentially, the wfMkdirParents function in GlobalFunctions.php needs to have
the mkdir function changed, or the $mode variable changed, when using IIS. The
folders it is creating do not have the correct permissions, even with the
/images/ directory set explicitly to recurs permissions to all children. I'd
change it myself, but I simply do not have the experience with the PHP/ISS mix
to get the permissions set using PHP. In php/apache or .net/iis this is a
simple function. I couldn't find ANYTHING useful on the web about how to
override permissions using php on iis.

All docs i can find say that php totally ignores the mode argument of mkdir when running under windows.

Not sure where that leaves us...

Bryan.TongMinh wrote:

(In reply to comment #7)

(In reply to comment #3)

Essentially, the wfMkdirParents function in GlobalFunctions.php needs to have
the mkdir function changed, or the $mode variable changed, when using IIS. The
folders it is creating do not have the correct permissions, even with the
/images/ directory set explicitly to recurs permissions to all children. I'd
change it myself, but I simply do not have the experience with the PHP/ISS mix
to get the permissions set using PHP. In php/apache or .net/iis this is a
simple function. I couldn't find ANYTHING useful on the web about how to
override permissions using php on iis.

All docs i can find say that php totally ignores the mode argument of mkdir
when running under windows.

Not sure where that leaves us...

Shelling out to cacls.exe to do its dirty magic. Not sure how desired that is though...

(In reply to comment #3)

How would I enable php errors?

http://www.mediawiki.org/wiki/Manual:How_to_debug (if it's still an issue)

Freer: Which IIS version is this about, and does this problem still happen in a currently supported MediaWiki version?

Freer: Which IIS version is this about, and does this problem still happen in a currently supported MediaWiki version?

Closing per last comment.