Results 1 to 6 of 6

Thread: IIS 6.0 Compability with PHP

  1. #1
    Junior Member
    Join Date
    Jun 2004
    Posts
    20

    Angry IIS 6.0 Compability with PHP

    When I Am Trying To Create And Write To File With PHP In wwwroot folder , i get the following error : PHP Warning: fopen(shout.txt): failed to open stream: Permission denied in d:\inetpub\wwwroot\shout.php on line 3 PHP Warning: fwrite(): supplied argument is not a valid stream resource in d:\inetpub\wwwroot\shout.php on line 10
    How TO Disable That. I Have Tried To Chang Permissions But It didn't Work :\

    And One More Thing..
    How To Remove Message "No Input File Specified" When I Am trying To Execute Non-existing .php file?

    Thank You For Help

  2. #2
    Nobody knows I'm a dog. TZ Veteran petard's Avatar
    Join Date
    Feb 2003
    Location
    Newspapastan
    Posts
    964
    Here's a site the has provided me some php-type help in the past:

    http://www.iis-resources.com/

    IIS v6 has introduced a ton of web security "enhancements" that will most like stop scripts that used to work in IIS v5.

    Good luck with your search. Sorry I couldn't be of more assistance.

    Many thanks to egghead for the cool .sig

  3. #3
    Junior Member zoggs's Avatar
    Join Date
    Oct 2004
    Location
    Strathalbyn, SA, Australia
    Posts
    2

    Wink wrapper workaround

    You are not alone with this one.

    A work-around is to use the full URL to the file. I know it seems unnecessary, but I can't find any switches in php.ini that would apply.

    ie

    $fp=fopen("//dev/testweb/test.txt",'w');
    fclose($fp);

    instead of

    $fp=fopen("test.txt",'w');
    fclose($fp);

    where dev is an IIS 5.0 server on XP with PHP 4.3.6.

    I believe this is a bug because the wrappers aren't resolving that path with proper permissions even though I have set them.

    Good luck!

  4. #4
    Junior Member zoggs's Avatar
    Join Date
    Oct 2004
    Location
    Strathalbyn, SA, Australia
    Posts
    2

    Thumbs up

    Today I found an equivalent DOS command to the unix CHMOD which fixed the problem. It is CACLS which is used to control the Access Control List (ACLs) for files.

    Open a DOS window, navigate to the directory that contains 'test.txt':

    I typed in -

    >cacls test.txt

    I got -

    "C:/ .... test.txt Everyone:R BUILTIN\Administrators:F "

    then type in

    >cacls test.txt /E /G IUSR_DEV:F <--- Don't forget the /E !!!!

    To check, I typed in again

    >cacls test.txt

    I got

    "cacls test.txt DEV\IUSR_DEV:F"

    You may get more results because your ACL may be different - different users, permissions etc.

    re-run the original script without the URL and it works as it should. I believe that while IIS is supposed to control r/w on the file as it reports to be doing, in fact it does not do a proper job.

    Cacls has other options and you can get these by typing "cacls" at a command prompt, but the 'C' is modify or Change permission.

    Note that my webserver is on machine 'DEV" so just replace your machine name. Of course your IIS user account is then IUSR_MACHINENAME.
    Last edited by zoggs; October 23rd, 2004 at 12:03 PM.

  5. #5
    Junior Member
    Join Date
    Feb 2005
    Posts
    1
    A Thousand thanks to zoggs for this info!!!

    I just spent four hours trying to set up a script on IIS that took five minutes on a Unix server.

  6. #6
    Junior Member
    Join Date
    Mar 2005
    Posts
    1
    The answer is a simple one, for IIS6 do the following (all other IIs's should be similar)

    right click the file i.e. visits.txt
    select the security tab
    add the internet guest user account eg IUSR_YOURSEVERNAME
    give the user permissions to write/modify to the file in question

    thats it, think about giving permissions to folder though

    hope it works for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •