[function.fopen]: failed to open stream: Permission denied
the error reported on the fwrite line:
Code: Select all
$f=fopen("$filename", "w+");
if ($f) {
fwrite($f, $data);
fclose($f);
return 1
Moderator: General Moderators
Code: Select all
$f=fopen("$filename", "w+");
if ($f) {
fwrite($f, $data);
fclose($f);
return 1
Uh, generally you get permission denied errors when you are denied permission.visitor-Q wrote:what is generally the source of this error?
[function.fopen]: failed to open stream: Permission denied
I agree with feyd. Did you try google: http://www.google.com/search?hl=en&q=ch ... ns+PHP+777visitor-Q wrote:stating the obvious and being a dick is a great way of helping those who are trying to learn.feyd wrote:Insulting us for answering the specific question you asked is a great way to get answers to what you are actually asking.visitor-Q wrote:next time, try not to be a dick.
thanks for your advice. unfortunately, that won't work. it is running on an IIS6 (microsoft) server (as the topic indicates). it does not respond to chmod. and i have already changed the permissions to the file manually (as mentioned in earlier posts) and that didn't work either.tecktalkcm0391 wrote:I agree with feyd. Did you try google: http://www.google.com/search?hl=en&q=ch ... ns+PHP+777visitor-Q wrote:stating the obvious and being a dick is a great way of helping those who are trying to learn.feyd wrote:Insulting us for answering the specific question you asked is a great way to get answers to what you are actually asking.
That would give you this: http://www.trap17.com/index.php/change- ... 10082.html
Just use PHP to change it to 777 which is allow all.
Being nice can get you anwsers.
Even though you are pretty rude ... have you tried to change the permissions on the folder containing the file, in addition to the file itself. The folder needs to be writable. I googled "php error [function.fopen]: failed to open stream: Permission denied on IIS6" and that's what most of links said to do.visitor-Q wrote:i tried checking the security properties for this file, and originally, it was only read and execute. but i changed the permissions and added write access to the file for random internet users. i restarted IIS, and it still won't work...
yes, i should have mentioned i changed the folder permissions along with the file inside the folder.arborint wrote:Even though you are pretty rude ... have you tried to change the permissions on the folder containing the file, in addition to the file itself. The folder needs to be writable. I googled "php error [function.fopen]: failed to open stream: Permission denied on IIS6" and that's what most of links said to do.visitor-Q wrote:i tried checking the security properties for this file, and originally, it was only read and execute. but i changed the permissions and added write access to the file for random internet users. i restarted IIS, and it still won't work...
My answer:visitor-Q wrote:what is generally the source of this error?
[function.fopen]: failed to open stream: Permission denied
Exactly how was that rude? Both feyd and I answered your question. You didn't ask how to fix it, you asked what caused it. We answered that. If you take the answer the wrong way because you didn't ask the question right, that is no one's fault but your own.Everah wrote:Uh, generally you get permission denied errors when you are denied permission.
Code: Select all
try {
$service = new COM('winmgmts:');
$sysobjects = $service->ExecQuery('SELECT * FROM Win32_ComputerSystem');
foreach($sysobjects as $o) {
echo $o->UserName, "<br />\n";
}
}
catch(Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "<br />\n";
}
// or
try {
$net = new COM("WSCRIPT.Network");
echo $net->UserName, "<br />\n";
}
catch(Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "<br />\n";
}