Page 1 of 1

Changing PHP permissions: Mac OS X

Posted: Mon Nov 07, 2005 11:25 pm
by prospero
I'm just learning PHP and when I try and open [the following], it returns the following error:

Code: Select all

Warning: fopen(newfile.file): failed to open stream: Permission denied in /Users/matt/Sites/hello.php on line 8

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$fp = fopen("file1.file", "w") or die("<font color='red'>WHOOPS</font>"); 
chmod($fp, 777);
$numBytes = fwrite($fp, "Lorem ipsum"); 
fclose($fp);
?>
</body>
</html>
I run Mac OS X, and I have no idea how to fix this. I am proficient with UNIX and I know Perl, so this minor problem is somewhat of a surprise to me. Any ideas, anyone?

Posted: Mon Nov 07, 2005 11:49 pm
by feyd
it sounds like your web server user doesn't have permission to write to the folder.. :?

Posted: Tue Nov 08, 2005 6:29 pm
by prospero
Well, I can see that. I just have no idea how to fix it.