When I call up in my browser the code with the touch() function in it, I get two error messages. The first informs me "Unable to create ... because Permission denied"; and the second tells me that the file "samplefile.txt" doesn't exist, so I can't possibly open it.

So is there a way to give myself Permission to create, read, and write to files that don't yet exist--sort of like an advance blanket permission?

Steve Tiano

    This is something I'm struggling with at the moment as well so I'm interested in any answers that come along. As I understand it PHP scripts execute with other authority (as opposed to owner or group) which doesn't give access to handy file commands such as move, create and unlink.

    So far my only work-arounds have been either to chmod a directory to 777 and only work in that folder or to use FTP (via sockets as my ISP doesn't have the FTP module installed).

      you need write permission on the directory to create files so
      if you issue the command

      chmod o+w <directory>

      that should correct your problem

      PHP scripts do execute with the other authority but what restrictions this imposes depends on the permission assigned

      kind regards
      paul

        Thanks very much for the info, Paul.

        So if I understand you, the "o" in "chmod o+w <directory> stands for "create"? Do I add a "+r" to enable reading files? Finally, am I correct in thinking I just put the directory name at the end, no angle brackets?

        And thanks again ... big time!

        Steve Tiano

          Write a Reply...