Re: [PHP] can't open a file

2007-07-24 Thread Shawn McKenzie
Most likely the web server (Apache?) is not running as you (your
username). Maybe it is, in which case take advice from the previous reply.

It's most likely running as another user.  On linux/unix there is a
specific user for the web server depending upon what server.  Apache is
normally, httpd, apache or nobody.  So that user would need permissions.

As a test, give everyone permission to the dir, then run your script and
see what user owns the created file.  Then you can grant only that user
write access to the file.

-Shawn

Crayon Shin Chan wrote:
> On Monday 23 July 2007 12:23, Ken Tozier wrote:
> 
>> The permissions for the "test" folder is set to me in a WebServer
>> subfolder on Mac OS X. 
> 
> What exactly does "permission ... set to me" mean?
> 
>> Do I need to set permissons to something else 
>> to get this to work? If so, what permissions should I use?
> 
> If you wanted to be able to create a file in the directory:
> 
> /a/b/c/d
> 
> then you would need 'execute' permission on each of the directory:
> 
> /a
> /a/b
> /a/b/c
> /a/b/c/d
> 
> in addition you need 'write' permission for the directory that the file is 
> created in, ie:
> 
> /a/b/c/d
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] can't open a file

2007-07-23 Thread Crayon Shin Chan
On Monday 23 July 2007 12:23, Ken Tozier wrote:

> The permissions for the "test" folder is set to me in a WebServer
> subfolder on Mac OS X. 

What exactly does "permission ... set to me" mean?

> Do I need to set permissons to something else 
> to get this to work? If so, what permissions should I use?

If you wanted to be able to create a file in the directory:

/a/b/c/d

then you would need 'execute' permission on each of the directory:

/a
/a/b
/a/b/c
/a/b/c/d

in addition you need 'write' permission for the directory that the file is 
created in, ie:

/a/b/c/d

-- 
Crayon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] can't open a file

2007-07-22 Thread Ken Tozier

Hi

I'm trying to create/open a file for write in a subfolder of the  
folder that contains my PHP script but am having no luck.


Here's the relevant code

$oldPath= 
'/test/old_page_'.$oldRecord['page_number'].'.txt';
$oldHand= fopen($oldPath, "w+");
if ($oldHand === true)
fwrite($oldHand, $oldData);
else
die('Failed to open file "'.$oldPath.'" for writing!');
fclose($oldHand);

The permissions for the "test" folder is set to me in a WebServer  
subfolder on Mac OS X. Do I need to set permissons to something else  
to get this to work? If so, what permissions should I use?


Thanks for any help

Ken






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php