...

View Full Version : VERY strange PHP file upload problem



0Alf0
03-04-2007, 09:50 PM
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!

aku
03-05-2007, 09:36 AM
check permissions!

0Alf0
03-05-2007, 02:23 PM
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!

Alex!
03-05-2007, 03:27 PM
Can you upload your upload script? You'll most probably get more answers if you do :)

Alex

0Alf0
03-05-2007, 04:15 PM
$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... :(

aku
03-05-2007, 06:21 PM
try to change the default tmp dir in php.ini [upload_tmp_dir]...

Inigoesdr
03-05-2007, 11:09 PM
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 (http://en.wikipedia.org/wiki/Large_file_support). You said your file wasn't very big, so:

How big is it exactly?
What type of file is it?
Why are you trying to edit a file in /tmp?

0Alf0
03-06-2007, 07:41 AM
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.

0Alf0
03-06-2007, 06:48 PM
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

Inigoesdr
03-06-2007, 06:58 PM
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.

0Alf0
03-06-2007, 08:10 PM
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.

Inigoesdr
03-06-2007, 08:55 PM
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.

0Alf0
03-10-2007, 12:31 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum