Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 27
  1. #1
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default Problem with imagecreatefromjpeg();

    Hi guys, I'm having a real tough time here.


    I've recompiled Apache with the gdlib in WHM; however, when I attempt to run:

    Code:
    error_reporting(E_ALL);
    
    // This is the temporary file created by PHP
    $uploadedfile = $_FILES['uploaded2']['tmp_name'];
    
    echo $uploadedfile;
    echo "<br/>";
    echo "<br/>";
    
    // Create an Image from it so we can do the resize
    
    $src = imagecreatefromjpeg($uploadedfile);
    var_dump($src);
    I get this:

    Warning: imagecreatefromjpeg(/tmp/phpk8YWjD) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/gameargu/public_html/cms/htms/admin-games-image-uploaded.php on line 312
    bool(false)

    I can't figure out why my temporary images are not saving on the server. Is there a setting I need to change in WHM? Please help...

  2. #2
    Member bin_asc's Avatar
    Join Date
    Jul 2005
    Posts
    280

    Default

    Seems like you have permission issues to the /tmp/. Check that you can read/write to /tmp.

  3. #3
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default

    Bin, first of all, thank you for helping me.

    Second, is the /tmp/ it is referring to the /tmp/ in my root, or is it the /tmp/ in the directory relative to where my script is?

  4. #4
    Member bin_asc's Avatar
    Join Date
    Jul 2005
    Posts
    280

    Default

    In the root. The /tmp/ partition. When you ssh in, type ls, you should see the /tmp

  5. #5
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default

    Is there a way to see what the default permissions are for that directory in SSH? A command?

  6. #6
    Member
    Join Date
    Sep 2004
    Posts
    887

    Default

    Quote Originally Posted by mjurmann View Post
    Is there a way to see what the default permissions are for that directory in SSH? A command?

    ls -alt /|grep tmp

  7. #7
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default

    I chmoded tmp in the root to 777 and then ran ls -l. The result was: drwxrwxrwx

    It's still not working...that is why I'm not sure if the command imagecreatefromjpeg is pointing to the right /tmp/ dir

  8. #8
    Member bin_asc's Avatar
    Join Date
    Jul 2005
    Posts
    280

    Default

    It is. I can take a look tomorrow at it, if you`d like, now I`m heading for zZzZz ... late here, good luck either way

  9. #9
    Member
    Join Date
    Sep 2004
    Posts
    887

    Default

    Quote Originally Posted by mjurmann View Post
    I chmoded tmp in the root to 777 and then ran ls -l. The result was: drwxrwxrwx

    It's still not working...that is why I'm not sure if the command imagecreatefromjpeg is pointing to the right /tmp/ dir
    First thing you'll want to do is chmod /tmp back to what it was before you changed it to 777. chmod'ing 777 is not the answer.

    Randomly chmoding directories (especially /tmp) to 777 puts you well on your way to getting rooted - because I'm also guessing you don't have /tmp mounted noexec, probably aren't running phpsuexec or suexec, and probably aren't running mod_security.

    Mike

  10. #10
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default

    Alright Mike, I chmoded it back to what it was.

    Do you have any idea why I'm getting this error? This function worked fine on the 3 shared servers I was on before this dedicated server that I'm using.

  11. #11
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default

    This is so confusing to me because according to phpinfo():


    Configure command:

    --with-gd' '--with-jpeg-dir=/usr/local'

    gd
    GD Support enabled
    GD Version bundled (2.0.28 compatible)
    GIF Read Support enabled
    GIF Create Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    XBM Support enabled

    Everything looks enabled and I just can't figure out why it won't put the file in the tmp directory

  12. #12
    Member serversphere's Avatar
    Join Date
    Jan 2004
    Posts
    658

    Default

    Quote Originally Posted by mtindor View Post
    I'm also guessing you don't have /tmp mounted noexec, probably aren't running phpsuexec or suexec
    I'm guessing this is the very problem. Try moving the file to your the account's directory first and then creating from it. You might not be able to execute in tmp because of one of the above.
    Darren Benfer | SS-Darren | AIM: serversphere
    www.serversphere.com
    Dedicated Server Solutions Have Come Full Circle

  13. #13
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default

    "Try moving the file to your the account's directory first and then creating from it. You might not be able to execute in tmp because of one of the above."

    Could you please explain this to me a little better? What file do I need to move to what directoy?

  14. #14
    Member
    Join Date
    Sep 2004
    Posts
    887

    Default

    I think he is saying that you should get your application to use /home/your_account_name/tmp as the temp directory instead of it using the default /tmp - because of the way permissions may be set on /tmp.

    Also - Via SSH:

    ls -alt / |grep tmp
    - show the results to us

    mount |grep tmp
    - show the results to us

    This way we can see what perms are on your /tmp directory and what mount directives were used.

    Mike

  15. #15
    Member
    Join Date
    Sep 2007
    Posts
    15

    Default

    ls -alt / |grep tmp

    drwxrwxrwx 7 gameargu gameargu 4096 Sep 25 16:38 tmp

    mount |grep tmp

    none on /dev/shm type tmpfs (rw)
    /dev/sda7 on /tmp type ext3 (rw,noexec,nosuid)
    /tmp on /var/tmp type none (rw,noexec,nosuid,bind)

    How do I go about telling an application to use a different temp directory other than the default tmp/ ?

Similar Threads & Tags
Similar threads

  1. Fatal error: Call to undefined function imagecreatefromjpeg()
    By rustikat in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 10-05-2007, 04:55 PM
  2. Cpanel/WHM problem, Exim problem, Mail problem
    By iroku in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 08-18-2006, 05:28 PM
  3. Email Sending Problem (451 Temporary local problem)
    By saj in forum E-mail Discussions
    Replies: 1
    Last Post: 03-30-2006, 11:07 AM
  4. Weird problem, urgent help needed with Mail problem
    By fuzioneer in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 09-07-2005, 05:00 AM
  5. FDF problem : Today I have problem when upgrade Apache
    By xmllist in forum cPanel Developers
    Replies: 0
    Last Post: 06-18-2004, 12:26 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube