Re: Folder permissions required to create/copy files in/into it during PHP script/code execution?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks.

Part of issue is I primarily use filezilla to manage file uploads, directory/folder structure, etc., and, yes, it allows you to set permissions, etc. via a dialogue, but, not sure if it's a display issue, since under the 3 sets of permission, owner, group and public, it's rendering the three types of permission as pseudo checkboxes, that you can turn on, off, or have what gets rendered to me as par'partially checked', but, it does also let you specify the resulting permission number/code as a 3 digit number as well, and while I think have used, or seen chmod command used in past to set permissions, the MSWindows command line FTP doesn't seem to recognise it as a command, although you'd expect the FTP server itself to be handling it, but, will try out the use of the mkdir command, and see how it operates.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

  ----- Original Message ----- 
  From: Richard Quadling 
  To: Jacob Kruger 
  Cc: php-windows 
  Sent: Thursday, August 22, 2013 4:10 PM
  Subject: Re:  Folder permissions required to create/copy files in/into it during PHP script/code execution?







  On 21 August 2013 17:00, Jacob Kruger <jacob@xxxxxxxxxxxxx> wrote:

    And, from the following page:
    http://www.zzee.com/solutions/linux-permissions.shtml

    0 All types of access are denied
    1 Execute access is allowed only
    2Write access is allowed only
    3 Write and execute access are allowed
    4 Read access is allowed only
    5 Read and execute access are allowed
    6 Read and write access are allowed
    7 Everything is allowed


    Jacob Kruger
    Blind Biker
    Skype: BlindZA
    '...fate had broken his body, but not his spirit...'

    ----- Original Message ----- From: "Jacob Kruger" <jacob@xxxxxxxxxxxxx>
    To: <php-windows@xxxxxxxxxxxxx>

    Sent: Wednesday, August 21, 2013 5:34 PM
    Subject: Re:  Folder permissions required to create/copy files in/into it during PHP script/code execution?




      Ok, might have now fixed this - firstly set folder permissions to 777, but, then, again, turned off public execute permissions, which seemed to revert permissions to 776, but, creating the text file, using the test script still worked - but, still just wondering what the specific permission difference/recommendation is/should be?

      Stay well

      Jacob Kruger
      Blind Biker
      Skype: BlindZA
      '...fate had broken his body, but not his spirit...'

      ----- Original Message ----- From: "Jacob Kruger" <jacob@xxxxxxxxxxxxx>
      To: <php-windows@xxxxxxxxxxxxx>
      Sent: Wednesday, August 21, 2013 5:05 PM
      Subject:  Folder permissions required to create/copy files in/into it during PHP script/code execution?


      I have got a /images folder, and I want to sometimes copy uploaded files from the temp path - using their temp_name file names, which works for other things, to then copy them into this folder in the root of the website, and renaming them at the same time to a name based on time() . rand(1, 10), etc.

      Now the file name generation works well enough, but, seems like no matter what permissions I set for that folder, for group, owner and public, where have even tried turning on all 3 of read, write and execute, using fileZilla - current permissions value ends up rendering as 766 - am guessing that 6 = rwe, but not ownership? - but, can't copy the files in there at runtime, and when also tried creating a test script, to just create a text file in that folder, and write to it, get same error message in server log:

      PHP Warning:  copy(../images/13770956916.png): failed to open stream: Permission denied

      and

      failed to open stream: Permission denied

      Is this possibly to do with it being a linux server, running Apache 2.0, or, the name of the folder /images, or am I missing something 'obvious' here?

      TIA, for any thoughts/ideas on what to try change

      Jacob Kruger
      Blind Biker
      Skype: BlindZA
      '...fate had broken his body, but not his spirit...'


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





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



  Hello Jacob.


  There is a peculiarity I have found coming to unix (well Mac, but CentOS also).


  If you want to use a directory like you would expect to use one, then it needs the execute property.


  To that end, I use mkdir($s_Directory, 0755, True); This creates the complete directory path, along with the ability to write files into it.


  It also automatically limits write capabilities to non-owner, making it read-only.




  I hope that helps.



  -- 
  Richard Quadling
  Twitter : @RQuadling

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux