Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question VERY strange PHP file upload problem

    I have a LAMP VPS that is running a file upload script. Even when uploading very small files, the script failes and returnes the following warning:
    "Warning: fopen(/tmp/phpvRfHjG) [function.fopen]: failed to open stream: Value too large for defined data type in"

    I get exactly the same message when using move_uploaded_file()...

    Ive spent hours searching for others with similiar problems on the net without success. As far as I understand, the warning usually occurs when people are dealing with very large files, which is not the case for me.

    Any ideas of what might be the reason? Any settings in php.ini or apache that might help?

    The server is running PHP5 and Apache2. The settings are mostly the defaults, with a few exceptions due to sercurity.

    Thanks for help!

  • #2
    aku
    aku is offline
    New Coder
    Join Date
    Jan 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    check permissions!

  • #3
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Permissions

    DO you really think that is the issue???

    Ive had problems with permissions before but then the warning usually says something like "failed to open stream: Permissions ....".

    Ive also chmod 777 on the both the /tmp (the default upload directory) directory and the directory where the files are supposed to be moved..

    This is really confusing...

    Thanks anyway!

  • #4
    Regular Coder
    Join Date
    Oct 2006
    Location
    Bristol
    Posts
    128
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you upload your upload script? You'll most probably get more answers if you do

    Alex
    Give me Rep if I was helpful and ignore if I wasn't ;)

    http://www.google.com <--use this before asking

    Nominate a Helpful Member


  • #5
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Ok, heres the script

    $ftmp = $_FILES['image']['tmp_name'];
    $fname = $_FILES['image']['name'];
    $fpath= "ufiles/".$fname;

    if(move_uploaded_file($ftmp, $fpath)) {
    ...
    }

    THe thing is that the script above did work, but after a couple of days it stopped to. I cant recall exactly what changes I did during this period, more than it was in the Apache and PHP config files and perhaps some SSH and vsftp config changes. But Ive restored the original settings for both PHP and Apache, but it still wont work.. THe only option I see right now is a complete reinstallation of the server...
    Last edited by 0Alf0; 03-05-2007 at 04:29 PM.

  • #6
    aku
    aku is offline
    New Coder
    Join Date
    Jan 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try to change the default tmp dir in php.ini [upload_tmp_dir]...

  • #7
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Quote Originally Posted by 0Alf0 View Post
    I have a LAMP VPS that is running a file upload script. Even when uploading very small files, the script failes and returnes the following warning:
    "Warning: fopen(/tmp/phpvRfHjG) [function.fopen]: failed to open stream: Value too large for defined data type in"

    I get exactly the same message when using move_uploaded_file()...

    Ive spent hours searching for others with similiar problems on the net without success. As far as I understand, the warning usually occurs when people are dealing with very large files, which is not the case for me.

    Any ideas of what might be the reason? Any settings in php.ini or apache that might help?

    The server is running PHP5 and Apache2. The settings are mostly the defaults, with a few exceptions due to sercurity.

    Thanks for help!
    This error is only reported by people trying to handle large files(anything >2GB) on systems that don't support LFS. You said your file wasn't very big, so:
    1. How big is it exactly?
    2. What type of file is it?
    3. Why are you trying to edit a file in /tmp?

  • #8
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, Ive tried with several small files, the recent one I uploaded was a standard textfile (.txt) of 434 bytes.

    Thy reason why I want to "edit" a file in /tmp directory is simply because this is the default directory where uploaded files are stored temporarly by PHP. So, move_uploaded_file just moves the file from this temporary to a user specified directory.

  • #9
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is an example output of some of the in the $_FILES error, just before move_uploaded_file() is called. As you can see, things seems fine, but its still fails and gives me the warning: "failed to open stream: Value to large for defined datatype".

    As you can see, the filesize is way below the 2G limit.

    size:23040
    tmo_name:/tmp/phpY0twZF
    is_uploaded_file():1

  • #10
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Try running the code on a regular server(not a VPS), to see if it works there. Try different files, and different file types to see if you still get the same error.

  • #11
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks.. Ive tried running the script on an other server and it do work then. So the problem is somewhere in the VPS-setup, not in the code. I just reinstalled both Apache2 and PHP5 but the problems remain...

    Can you see any changes that the server-hosting company might have done with the virtualization software (Linux V-server) that are causing this problems??? Any other Linux configs (Debian sarge) that I might have changed "accidently"??

    Thank you guys.

  • #12
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    I can't think of anything, maybe someone else can help with that. You should report this as a bug to your host, the VPS vendor, and PHP though. Someone might have found a fix for it already; Check their respective Bug reports.

  • #13
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up The solution

    I finaly found what, I believe, is the "source" of the error...

    Just before the error started to happen we changed som DNS-settings via our server host. This included some changes on how incoming emails are supposed to be redirected... As soon as we removed those settings, things started to work again.

    Maybe somebody can tell how these kind of settings can result in the strange warning above..? I cant..

    Anyway, thanks to you guys who came up with suggestions.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •