View Full Version : IIS 6.0 Compability with PHP
wykis
July 2nd, 2004, 14:40 PM
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
petard
July 6th, 2004, 13:07 PM
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.
zoggs
October 22nd, 2004, 13:21 PM
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! :)
zoggs
October 23rd, 2004, 02:08 AM
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.
ranfo.com
February 23rd, 2005, 00:25 AM
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.
shiver
March 22nd, 2005, 21:04 PM
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.
|
|