Page 1 of 1
upload_max_filesize is going nuts...
Posted: Wed Jul 20, 2005 1:47 pm
by Skara
Ok, explain this to me. This is in my php.ini:
I'm trying to upload a 6mb file and I'm getting the error that it exceeds the upload_max_filesize in php.ini. O.o
To make sure I'm not going nuts with my code, here's the little error thing I've got:
Code: Select all
if ($_FILES['userfile']['error'] != UPLOAD_ERR_OK) {
switch($_FILES['userfile']['error']) {
case 1: $err = 'File exceeds upload_max_filesize directive in php.ini.'; break;
case 2: $err = 'File exceeds MAX_FILE_SIZE directive supplied in html form.'; break;
case 3: $err = 'File only partially uploaded.'; break;
case 4: $err = 'No file was uploaded.'; break;
case 6: $err = 'Missing temporary folder.'; break;
default: $err = 'Undefined error.'; break;
}
err($err);
}
As I said, I'm getting the first one every time. It worked fine with a 1.5mb file.
Edit: Yes, I restarted apache. Figured I'd better mention that.
Posted: Wed Jul 20, 2005 4:49 pm
by Burrito
did you make sure that your max post size was adjusted too?
Posted: Wed Jul 20, 2005 7:07 pm
by Skara
Yeap, did that too. You think maybe it's something in apache's conf? I've checked through my files but don't see anything.
Posted: Thu Jul 21, 2005 1:01 am
by dreamline
I know the problem, I have it slightly different, however the result is the same.
@ home everything works fine, but at my webhost every file above 1MB results in a page not found.
I ran through all the php settings and couldn't detect a problem with exceeding values.
So the problem must ly elsewhere, if my webhost solves the problem and informs me about it then i'll make sure to post it here too, since it may related.
Posted: Thu Jul 21, 2005 10:12 am
by dreamline
K, here's my update or at least in my favor... I looked through some apache logfiles and for me my problem is that there is a setting in apache (don't know which version) somewhere that limits upload requests to 525K.. So my problem was apache related.

And i had to figure it out as my Webhost didn't yet... LOL.. Now that's funny they are supposed to be the experts..
I certainly hope someone can use this info if they run into any apache or page cannot be found problems when uploading...
Posted: Thu Jul 21, 2005 2:37 pm
by Skara
Could you tell me what the line looked like? I've looked through all my conf files and can't find anything that looks like that.
Posted: Thu Jul 21, 2005 10:53 pm
by dreamline
It probably has to do with Linux as an operating system. I found something about:
etc/httpd/conf.d/php.conf
Since I am running NT don't have the exact line where to find it, but i passed this one on to my webhost and they found the file and corrected the setting..
My webhost is running Linux and it caused problems in combo with Apache.
Try checking your Apache error logs. This is what i found there:
Thu Jul 21 16:35:23 2005] [error] [client 213.148.229.41] Requested content-length of 3447790 is larger than the configured limit of 524288, referer: hxxp://xxxxxxx

Posted: Mon Aug 01, 2005 4:29 pm
by Skara
Sorry about the long wait, I was on business/vacation. So...
/etc/httpd/conf.d/php.conf isn't the same on every pc. I have:
/etc/apache2/conf/apache2.conf
./commonapache2.conf
./skara.conf
./modules.d/[a few files]
Anyway, I'm not getting any errors at all in apache's error log.
Posted: Mon Aug 01, 2005 9:07 pm
by Ambush Commander
What's the max filesize you can upload?
Posted: Sat Aug 06, 2005 10:19 am
by Skara
I really don't know. It works with a ~2mb file but not with a ~6mb.
There's another thing to consider too... I'm uploading a tarball and uncompressing it. It contains a folder full of a few pictures which I then make thumbnails from. In other words...
* Upload tarball and move it.
* Uncompress it with exec('tar xfz $file');
* Loop through each picture and create a thumbnail for it.
Each pic is max 800x600. Each thumbnail is max 200x150.
Could any of that affect it?
Posted: Sat Aug 13, 2005 8:43 pm
by Skara
bump. This is really important. ...Although it may not seem like it given the time between my posts.
Does anyone have
any idea of where to look?
Posted: Sat Aug 13, 2005 8:49 pm
by feyd
if you are incorrectly handling the images, you could easily run out of memory.
Posted: Sat Aug 13, 2005 9:45 pm
by Ambush Commander
Okay. Time for drastic measures.
1. First, make sure it's not your script. That is, take a well documented example (preferably from the PHP manual), and try uploading a big file.
2. Next, make sure it's not PHP. Reinstall PHP, try several different versions, make sure you get rid of everything (including configuration files). Don't forget to reconfigure PHP to allow bigger uploads.
3. Then, reinstall Apache. Same as 2.
4. Then, reinstall your OS.

Hopefully, you'll only get to 2, maybe 3.
Posted: Mon Aug 15, 2005 9:53 pm
by Skara
tried using a snip from the manual and got the same error.
I don't see why I should have to reinstall php, though. Shouldn't just changing php.ini do whatever I need to? I have 4.3.11, btw.
ignore above ^
Oh wow. Oh no. I just looked at my phpinfo page rather than open up php.ini and it's different than my config file!!
Yes, I restarted apache. Rebooted my system a couple of times since this started, actually.
Now my problem is, I have only one php.ini (according to slocate). Obviously the real one got named something else or some such. According to phpinfo, it's located at /etc/php/cli-php4. But wait!!! That location doesn't exist!! In fact, slocate can't find anything like cli-php4 anywhere!!
...my bad. Could someone please explain to me how to change this without recompiling php?