Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8127057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:23:06+00:00 2026-06-06T07:23:06+00:00

I’m having a problem with a PHP website running on IIS 7 on Windows

  • 0

I’m having a problem with a PHP website running on IIS 7 on Windows Server 2008.

There is one line of code calling mkdir which is erroring and the error log reads:

“… permission denied …”

I have ruled out anything to do with folder permissions (I have tried multiple groups: Everyone, Users, IUSR, Network Service etc. with no luck).

I need to know how mkdir works, does it check the read-only attribute of the parent folder?

If so, then this could be the root of the problem as all folders in Windows Server 2008 are marked as “Read Only” and the checkbox is greyed-out – Microsoft say it is “by design” but I think it is really “bad design”.

Please help.

P.S. The line of code which errors can be found here https://github.com/LimeSurvey/LimeSurvey/blob/070d255ba381d7abcd231d7c9e0c7d11f5578c97/admin/templates.php#L1182 it is line 1182.

SOLUTION:

  • It was a permissions issue after all!
  • We were applying permissions to the wrong folder (smacks hand to forehead)
  • There are two “Templates” folders: /Templates and /Uploads/Templates
  • /Template is for default templates whereas /Uploads/Templates is for user-created ones
  • We gave the “Users” group r/w/execute/modify permissions to /Uploads/Templates folder
  • Whereas previously we were applying permissions to /Templates
  • To debug this I used echo to output the $target value

LESSONS LEARNT:

  • Always read the error message – it said “permission denied” and I didn’t believe it
  • Don’t assume the obvious to be true – /Templates wasn’t the right folder
  • If the code is erroring then debug the code and don’t try to guess the problem
  • Debug the code using simple techniques such as outputting variable values – e.g. echo
  • Listen to the majority – most people here were right in saying IT IS A PERMISSIONS ISSUE!
  • Most errors have a simple fix – don’t go looking for something complex

Bounty awarded to @BOMEz because of the useful quote from mkdir() documentation which indicated that I should double-think the permissions. @BOMEz also provided a tailored answer and interacted with me via comments which helped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:23:09+00:00Added an answer on June 6, 2026 at 7:23 am
    • As a test (preferably in a development environment) give the IIS user full access to the parent folder. If this makes it work, slowly start taking away privileges to see which ones you need.

    • Try changing:

      if(mkdir($target,0777))

    to:

    if(mkdir($target))

    Windows ignores the mode option. Might be some weird bug causing it to fail.

    Additionally for your $target variable could you try forcing it to link to the full Windows path? Such as C:\Program Files\ IIS\...

    I’ve ran into situations with windows before where access was denied attempting to use a relative path, but the full path works just fine.

    EDIT:
    Looking at the comments on the documentation for mkdir() one commenter mentions that you might also need to add execute permissions to the user:

    If you’re getting a Permission Denied error, but are certain the
    permissions and ownership where you are trying to create the directory
    are correct, check again:

    The location where you are trying to create the directory in must have
    the Execute permission for the owner trying to create it, regardless
    of if the folder is Readable, or Writable.

    This may be obvious to some, but was not to me at first. Hopefully
    this will save you the trouble I went through.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.