I have encounter an problem moving onto my test (and attempted it on push, no go) where I've got a php script produce a file and set some data for the reason that file.

I have set the permissions to R, W, X for "Owner, Group, Other" using winSCP (i am very little for commandline yet).

What i can tell would be that the script has the capacity to produce the file (i have erased, also it recreates the files correctly each time), however the identical script can't email the file and that i obtain a permission error. "unsuccessful to spread out stream: permission refused"

Here's the script that I am using,it labored in home windows, however on linux, no go.

Any ideas?


$type='get'

$count_my_page = ("list".$counterDate.".txt")

if(!file_is available($count_my_page))scribe($putArray)

fputs($fp, $putJson)

fclose($fp)

 else scribe($putArray)

 else is available($type, $putArray)) else 



$putJson=json_scribe($putArray)

$fp=fopen($count_my_page, "w")

fputs($fp, $putJson)

fclose($fp)



Developing a file requires write permission around the directory (that's most likely that which you set with winscp ?).

But modifying personal files requires write permissions around the file itself.
To provide such permissions to Apache, you may have to make use of the function chmod after you are done creating the file.

Something similar to this may do, I guess :

chmod($count_my_page, 0666);

6 = 4 (read) + 2 (write).
You don't have to give execution (1) privilegies.

Performs this help ?


And That I supposed it done home windows because Apache run as the user (or as administrator) -- or because Windows' permission product is more permissive


Edit : for additional particulars about permissions under Linux, you may things to have a look at this part of the corresponding Wikipedia article (estimating) :

You will find three specific permissions on Unix-like systems that affect each class:

  • The read permission, which grants or loans a chance to read personal files. When set for any directory, this permission grants or loans a chance to browse the names of files within the directory (although not to discover any more details about them, including file type, size, possession, permissions, etc.)
  • The write permission, which grants or loans a chance to modify personal files. When set for any directory, this permission grants or loans a chance to modify records within the directory. Including creating files, removing files, and renaming files.
  • The execute permission, which grants or loans a chance to perform file. This permission should be looking for executable binaries (for instance, a put together c++ program) or spend scripts (for example, a Perl program) to be able to permit the operating-system to operate them. When looking for a directory, this permission grants or loans a chance to traverse its tree to be able to access files or subdirectories, although not see files within the directory (unless of course read is placed).


You might enjoy [cde], but I have always prefered calling chmod when it is necessary (and just when it is necessary : I favor not giving an excessive amount of permissions -- safer by doing this) -- and umask might have some issues with some servers, basically remember properly