System() and ImageMagick

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ph1975@gmail.com

    System() and ImageMagick

    Hi Folks,

    the following problem occured:

    i use imagemagick (Version: ImageMagick 6.2.2 05/26/05 Q16 on Fedora
    Core 3 Server)
    When i manually (on bash) execute:

    /usr/bin/convert -size 300x267
    /var/www/html/web4/html/_img/_2/b28a3240dffa1ca d3dab0e877a3d7c 5e.jpg
    -resize 126x100+0+-6 +profile "*"
    /var/www/html/web4/html/_img/_2/_tn/t_b28a3240dffa1 cad3dab0e877a3d 7c5e.jpg

    it works. (i am root)

    executing the same within a PHP Script with system(... command as shown
    above ...);

    i get the following output:
    convert: unable to open image
    `/var/www/html/web4/html/_img/_2/fa1d0a1d407f077 aa98c8498b3e8be 7d.jpg':
    Permission denied.


    The /var/ folder belongs to root and has chmod 755
    /var/www/ has 777 (root),
    /var/www/web4/ has 777 (apache --the httpd runs on user
    apache:apache),
    /var/www/web4/html/ ... till _img/_2/.... has 777 and is
    apache:apache.

    I really don't get this.... can anyone give me a hint? Even googling
    didn't resolve this issue.

    THanks a lot,
    cheers.
    -phil

  • Petr Vileta

    #2
    Re: System() and ImageMagick

    <ph1975@gmail.c omwrote in
    news:1157664545 .977103.188170@ e3g2000cwe.goog legroups.com...
    Hi Folks,
    >
    the following problem occured:
    >
    i use imagemagick (Version: ImageMagick 6.2.2 05/26/05 Q16 on Fedora
    Core 3 Server)
    When i manually (on bash) execute:
    >
    /usr/bin/convert -size 300x267
    /var/www/html/web4/html/_img/_2/b28a3240dffa1ca d3dab0e877a3d7c 5e.jpg
    -resize 126x100+0+-6 +profile "*"
    /var/www/html/web4/html/_img/_2/_tn/t_b28a3240dffa1 cad3dab0e877a3d 7c5e.jpg
    >
    it works. (i am root)
    >
    executing the same within a PHP Script with system(... command as shown
    above ...);
    >
    i get the following output:
    convert: unable to open image
    `/var/www/html/web4/html/_img/_2/fa1d0a1d407f077 aa98c8498b3e8be 7d.jpg':
    Permission denied.
    >
    >
    The /var/ folder belongs to root and has chmod 755
    /var/www/ has 777 (root),
    /var/www/web4/ has 777 (apache --the httpd runs on user
    apache:apache),
    /var/www/web4/html/ ... till _img/_2/.... has 777 and is
    apache:apache.
    >
    I really don't get this.... can anyone give me a hint? Even googling
    didn't resolve this issue.
    >
    I will solve this not long ago :-)
    I'm not sure if this is not a security hole but this work for me.
    /var/ must have provileges 77x
    /var/www/ 77x
    /var/www/web4/ 77x
    /var/www/web4/html/ 77x

    and for all directories the group must be some group where "apache" is a
    member of this group.
    And at the end you MUST RESTART Apache ;-) because Apache is running using
    privileges readed at start time.
    --

    Petr Vileta, Czech republic
    (My server rejects all messages from Yahoo and Hotmail. Send me your mail
    from another non-spammer site please.)


    Comment

    • Alvaro G. Vicario

      #3
      Re: System() and ImageMagick

      *** ph1975@gmail.co m escribió/wrote (7 Sep 2006 14:29:06 -0700):
      convert: unable to open image
      `/var/www/html/web4/html/_img/_2/fa1d0a1d407f077 aa98c8498b3e8be 7d.jpg':
      Permission denied.
      >
      >
      The /var/ folder belongs to root and has chmod 755
      /var/www/ has 777 (root),
      /var/www/web4/ has 777 (apache --the httpd runs on user
      apache:apache),
      /var/www/web4/html/ ... till _img/_2/.... has 777 and is
      apache:apache.
      Sorry if it's too obvious but... what are the permissions of the file
      itself?

      --
      -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
      ++ Mi sitio sobre programación web: http://bits.demogracia.com
      +- Mi web de humor con rayos UVA: http://www.demogracia.com
      --

      Comment

      • ph1975@gmail.com

        #4
        Re: System() and ImageMagick


        Alvaro G. Vicario schrieb:
        *** ph1975@gmail.co m escribió/wrote (7 Sep 2006 14:29:06 -0700):
        convert: unable to open image
        `/var/www/html/web4/html/_img/_2/fa1d0a1d407f077 aa98c8498b3e8be 7d.jpg':
        Permission denied.


        The /var/ folder belongs to root and has chmod 755
        /var/www/ has 777 (root),
        /var/www/web4/ has 777 (apache --the httpd runs on user
        apache:apache),
        /var/www/web4/html/ ... till _img/_2/.... has 777 and is
        apache:apache.
        >
        Sorry if it's too obvious but... what are the permissions of the file
        itself?
        >
        --
        -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
        ++ Mi sitio sobre programación web: http://bits.demogracia.com
        +- Mi web de humor con rayos UVA: http://www.demogracia.com
        --

        Comment

        • ph1975@gmail.com

          #5
          Re: System() and ImageMagick


          Alvaro G. Vicario schrieb:
          *** ph1975@gmail.co m escribió/wrote (7 Sep 2006 14:29:06 -0700):
          convert: unable to open image
          `/var/www/html/web4/html/_img/_2/fa1d0a1d407f077 aa98c8498b3e8be 7d.jpg':
          Permission denied.


          The /var/ folder belongs to root and has chmod 755
          /var/www/ has 777 (root),
          /var/www/web4/ has 777 (apache --the httpd runs on user
          apache:apache),
          /var/www/web4/html/ ... till _img/_2/.... has 777 and is
          apache:apache.
          >
          Sorry if it's too obvious but... what are the permissions of the file
          itself?
          >

          i tried the files with 777 and 755. always same error :-(
          --
          -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
          ++ Mi sitio sobre programación web: http://bits.demogracia.com
          +- Mi web de humor con rayos UVA: http://www.demogracia.com
          --

          Comment

          • ph1975@gmail.com

            #6
            Re: System() and ImageMagick

            I tried everything from the above. i even put "apache" user in root
            group ... same error...

            Do you have any other tipps ?

            Comment

            • Alvaro G. Vicario

              #7
              Re: System() and ImageMagick

              *** ph1975@gmail.co m escribió/wrote (9 Sep 2006 12:26:30 -0700):
              I tried everything from the above. i even put "apache" user in root
              group ... same error...
              >
              Do you have any other tipps ?
              One guess... Do you have a SELinux enhanced Linux distro, such as Fedora
              Core? If so, there's a graphical tool somewhere (titled "Security") that
              allows you to enable/desable SELinux. Try it out.


              --
              -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
              ++ Mi sitio sobre programación web: http://bits.demogracia.com
              +- Mi web de humor con rayos UVA: http://www.demogracia.com
              --

              Comment

              Working...