Changing PHP permissions: Mac OS X

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prospero
Forum Newbie
Posts: 2
Joined: Mon Nov 07, 2005 11:18 pm

Changing PHP permissions: Mac OS X

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it sounds like your web server user doesn't have permission to write to the folder.. :?
prospero
Forum Newbie
Posts: 2
Joined: Mon Nov 07, 2005 11:18 pm

Post by prospero »

Well, I can see that. I just have no idea how to fix it.
Post Reply