folder and file permissions to read and write images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eholz1

    folder and file permissions to read and write images

    Hello PHP Group,

    I am having trouble setting permissions correctly so that the
    magickwand api (php 5.2) can read and
    write images. I usually read a file from one directory, create a
    magickwand resource from that file,
    and transform the image, and save the new image with a new name to a
    different directory.

    I have seen that my file and folder permissions when set incorrectly,
    will definitely cause problems!
    Below is a copy of an error message I get when I try to read an image
    and write, etc.

    Fatal Error: magickreadimage (): C API cannot read the file
    "/usr/local/apache2/htdocs/portfolios/25/coffeeandcars.J PG"
    (reason: unable to open image `/usr/local/apache2/htdocs/portfolios/25/
    coffeeandcars.J PG':
    Permission denied) [on C source line 392] (# 256).

    Error in line 58 of file '/usr/local/apache2/htdocs/portfolios/
    thumbmaker.php' .

    Script: '/portfolios/thumbmaker.php' .


    I have tried setting the owner and group to apache.apache, and
    apache.webdev (webdev is a group I created, where the apache user and
    another user are a member). I am running the Apache web server as the
    user "apache".

    Any suggestions on the correct permissions to get the read and writes
    to work??

    thanks,
    eholz1

  • Mathias K.

    #2
    Re: folder and file permissions to read and write images

    Am 15 Mar 2007 10:45:04 -0700 schrieb eholz1:
    Hello PHP Group,
    >
    I am having trouble setting permissions correctly so that the
    magickwand api (php 5.2) can read and
    write images. I usually read a file from one directory, create a
    magickwand resource from that file,
    and transform the image, and save the new image with a new name to a
    different directory.
    >
    I have seen that my file and folder permissions when set incorrectly,
    will definitely cause problems!
    Below is a copy of an error message I get when I try to read an image
    and write, etc.
    >
    Fatal Error: magickreadimage (): C API cannot read the file
    "/usr/local/apache2/htdocs/portfolios/25/coffeeandcars.J PG"
    (reason: unable to open image `/usr/local/apache2/htdocs/portfolios/25/
    coffeeandcars.J PG':
    Permission denied) [on C source line 392] (# 256).
    >
    Error in line 58 of file '/usr/local/apache2/htdocs/portfolios/
    thumbmaker.php' .
    >
    Script: '/portfolios/thumbmaker.php' .
    >
    >
    I have tried setting the owner and group to apache.apache, and
    apache.webdev (webdev is a group I created, where the apache user and
    another user are a member). I am running the Apache web server as the
    user "apache".
    >
    Any suggestions on the correct permissions to get the read and writes
    to work??
    >
    thanks,
    eholz1
    Hello!

    The problem probably lies in the actual permissions and not in who is the
    owner of the file. The user has to have writing access as for example: 755
    (owner has right to write and read, as well as execute, group and other can
    read and execute only). Note that some php functions need exec right to
    work properly.

    If you have set the right to 755 or 744 or whatever the owner of the file
    must be Apache. The user can have different names like www, wwwrun or as
    you said apache. If your script doesn't work a different user seems to run
    the scripts when you access them via HTTP.

    If you can't find the proper user to set as owner just assign 777 to the
    images folder so everyone can read and write. Of course the images have to
    have the same rights when they shall be overwritten at any time.


    ~ MK

    Comment

    • eholz1

      #3
      Re: folder and file permissions to read and write images

      On Mar 15, 10:34 am, "Mathias K." <mformetalh...@ yahoo.dewrote:
      Am 15 Mar 2007 10:45:04 -0700 schrieb eholz1:
      >
      >
      >
      Hello PHP Group,
      >
      I am having trouble setting permissions correctly so that the
      magickwand api (php 5.2) can read and
      write images. I usually read a file from one directory, create a
      magickwand resource from that file,
      and transform the image, and save the new image with a new name to a
      different directory.
      >
      I have seen that my file and folder permissions when set incorrectly,
      will definitely cause problems!
      Below is a copy of an error message I get when I try to read an image
      and write, etc.
      >
      Fatal Error: magickreadimage (): C API cannot read the file
      "/usr/local/apache2/htdocs/portfolios/25/coffeeandcars.J PG"
      (reason: unable to open image `/usr/local/apache2/htdocs/portfolios/25/
      coffeeandcars.J PG':
      Permission denied) [on C source line 392] (# 256).
      >
      Error in line 58 of file '/usr/local/apache2/htdocs/portfolios/
      thumbmaker.php' .
      >
      Script: '/portfolios/thumbmaker.php' .
      >
      I have tried setting the owner and group to apache.apache, and
      apache.webdev (webdev is a group I created, where the apache user and
      another user are a member). I am running the Apache web server as the
      user "apache".
      >
      Any suggestions on the correct permissions to get the read and writes
      to work??
      >
      thanks,
      eholz1
      >
      Hello!
      >
      The problem probably lies in the actual permissions and not in who is the
      owner of the file. The user has to have writing access as for example: 755
      (owner has right to write and read, as well as execute, group and other can
      read and execute only). Note that some php functions need exec right to
      work properly.
      >
      If you have set the right to 755 or 744 or whatever the owner of the file
      must be Apache. The user can have different names like www, wwwrun or as
      you said apache. If your script doesn't work a different user seems to run
      the scripts when you access them via HTTP.
      >
      If you can't find the proper user to set as owner just assign 777 to the
      images folder so everyone can read and write. Of course the images have to
      have the same rights when they shall be overwritten at any time.
      >
      ~ MK
      Hello Mathias

      Sie haben recht! Ich machen alles 0755 fur meine folders and files,
      Alles in Ordnung jetz!
      Ich bin dumm.

      I am thinking setting 755 was too easy!
      Live and learn,
      fielen Danke!
      Thanks,
      eholz1

      Comment

      • Mathias K.

        #4
        Re: folder and file permissions to read and write images

        Am 15 Mar 2007 14:58:18 -0700 schrieb eholz1:
        On Mar 15, 10:34 am, "Mathias K." <mformetalh...@ yahoo.dewrote:
        >Am 15 Mar 2007 10:45:04 -0700 schrieb eholz1:
        >>
        >>
        >>
        >>Hello PHP Group,
        >>
        >>I am having trouble setting permissions correctly so that the
        >>magickwand api (php 5.2) can read and
        >>write images. I usually read a file from one directory, create a
        >>magickwand resource from that file,
        >>and transform the image, and save the new image with a new name to a
        >>different directory.
        >>
        >>I have seen that my file and folder permissions when set incorrectly,
        >>will definitely cause problems!
        >>Below is a copy of an error message I get when I try to read an image
        >>and write, etc.
        >>
        >>Fatal Error: magickreadimage (): C API cannot read the file
        >>"/usr/local/apache2/htdocs/portfolios/25/coffeeandcars.J PG"
        >>(reason: unable to open image `/usr/local/apache2/htdocs/portfolios/25/
        >>coffeeandcars .JPG':
        >>Permission denied) [on C source line 392] (# 256).
        >>
        >>Error in line 58 of file '/usr/local/apache2/htdocs/portfolios/
        >>thumbmaker.ph p'.
        >>
        >>Script: '/portfolios/thumbmaker.php' .
        >>
        >>I have tried setting the owner and group to apache.apache, and
        >>apache.webd ev (webdev is a group I created, where the apache user and
        >>another user are a member). I am running the Apache web server as the
        >>user "apache".
        >>
        >>Any suggestions on the correct permissions to get the read and writes
        >>to work??
        >>
        >>thanks,
        >>eholz1
        >>
        >Hello!
        >>
        >The problem probably lies in the actual permissions and not in who is the
        >owner of the file. The user has to have writing access as for example: 755
        >(owner has right to write and read, as well as execute, group and other can
        >read and execute only). Note that some php functions need exec right to
        >work properly.
        >>
        >If you have set the right to 755 or 744 or whatever the owner of the file
        >must be Apache. The user can have different names like www, wwwrun or as
        >you said apache. If your script doesn't work a different user seems to run
        >the scripts when you access them via HTTP.
        >>
        >If you can't find the proper user to set as owner just assign 777 to the
        >images folder so everyone can read and write. Of course the images have to
        >have the same rights when they shall be overwritten at any time.
        >>
        >~ MK
        >
        Hello Mathias
        >
        Sie haben recht! Ich machen alles 0755 fur meine folders and files,
        Alles in Ordnung jetz!
        Ich bin dumm.
        >
        I am thinking setting 755 was too easy!
        Live and learn,
        fielen Danke!
        Thanks,
        eholz1
        Hehe, good that the solution was that easy.

        Du bist nicht dumm, irren ist menschlich. ;-)
        Wie du sagtest, leben und lernen. :)


        Mit freundlichem Gruß,

        M.K.

        Comment

        Working...