php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #22158 "8M" isn't and integer is it ?
Submitted: 2003-02-10 18:52 UTC Modified: 2004-08-05 07:25 UTC
Votes:5
Avg. Score:3.8 ± 1.2
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: greg at getnetez dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.2.2 OS: Red Hat 8.0
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 - 32 = ?
Subscribe to this entry?

 
 [2003-02-10 18:52 UTC] greg at getnetez dot com
First off, I think you guys are great and I would be at a loss without you.... so many-many thanks....

But..... while troubleshooting a file upload issue with imp (standard thing reported many times in a number of different varieties upload_max_filesize ignored and the likewise post_max_size ignored and even memory_limit doesn't matter) I first looked to my php.ini and started adjusting these settings to no avail.
My actual problem was a gem of a file httpd/conf.d/php.conf which contained --

<Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    LimitRequestBody 524288
</Files>

the cause of my httpd/errorlog file noting... 
"Requested content-length of 2172475 is larger than the configured limit of 524288" --> that's what I get for Red Hat RPMs instead of real files.... 

Anyway.... the possible "bug" is that the documentation specifically states that all three of these configuration directives are of type integer and the default is "8M"... it seems to me that should be 8000000 if the unit is bytes. And, even the units of the directive is a bit unclear and should be clearly stated, I think.

Thanks for your patience and good work.... and if this isn't in line... well I fixed my problem so I'm still thrilled with you folks.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-10 19:28 UTC] sniper@php.net
This needs a bit clarifying in the docs..

M (or K) can only be used in php.ini file. In .htaccess / httpd.conf you have to use plain integer for the bytes.

 [2003-02-20 08:27 UTC] jpulk at unumprovident dot com
Shouldn't the values in php.ini have precedence over this value in php.conf.  If not then this make ini_set pretty useless when a developer wants to upload larger files and doesn't have access to change the php.conf file.  

I have experienced a similar situation which i will describe.

---------------------------------------------------------
Ok. I have an upload script that was only allowing me to upload files in the several hundred byte range even though the upload_max_filesize in php.ini is set at 2M. 

So I moved all the files to a new server. Now I am limited to anything over 450KB. Again the value in php.ini is set at 2M. 

it is almost like a tmp copy of the image isn't getting copied to the server with the larger images because I get an error: 

Warning: getimagesize: Unable to open '' for reading. in /home/public_html/uploadimage.php on line 75 

The same picture, same name, same dimensions brought into PhotoShop and saved with a lower quality rating will upload no problem. 

When I: 

print_r($_POST); 
print_r($_FILES); 

I Get: 

( [MAX_FILE_SIZE] => 8000000 [Submit] => Submit Picture ) Array ( [myfile] => Array ( [name] => myfile3.jpg [type] => image/pjpeg [tmp_name] => /tmp/php8SdQOI [error] => 0 [size] => 436817 ) ) 

This is with a file that works. When I throw a file of size 835213 at it both arrays are empty. 

---------------------------------------------------------

My original assumption was that it was 450KB because that is what i had for a file.  I worked over my image in photoshop some more. So that i had a 520,292byte file and a 529,034 byte file.  The slightly smaller on will upload.  It?s amazing.  

I have not had the php.conf file changed on the server yet because i do not have those permissions but it sounds like this is my problem.  

If so how will this bug (if a bug) be resolved.  No one on any php forums that i could find, could explain this situation to me until i landed here.  This situtation should be better annonce in my opinion.
 [2003-02-21 15:30 UTC] greg at getnetez dot com
The php.conf file I found is actually in the configuration directives for Apache 2.0

As php is running as an apache module, I'd have to say it makes sense to me that the php.ini values are subordinate to the webserver configuration.

But... on the good side :-) 

Your upload limits are right on target with what I found as limits in my Apache 2.0 configuration. So, if you can change your Apache config files or get the adminstrator thereof to do so... you should be able to post the large pics as well.

Cheers,
Greg
 [2003-03-06 20:01 UTC] pmoulding at tedis dot com dot au
I ran a test using PHP 4.3.0 and the latest Apache 2 on a little NT workstation. The test added a 1 Mb string to an array 1000 times. The test ran to completion despite php.ini containing a limit of 8M.

I ran the test because I need an example page showing the memory limit exceeded message. So far, the message has not popped up no matter what I do.

I sometimes use .htaccess but not in the Web site where I ran the test.

The Apache .conf has the bare minimum settings to get PHP running. I do not remember any settings overriding PHP.ini. 

PHP is installed using the 4.3.0 release binary so has no compile time overrides by me.

I use the module version, not CGI.

The test script ran quickly so I though PHP might have dropped the extra data. NT reported the process using the full gigabyte so PHP must have allocated the gigabyte.

Please list additional places where I should look for memory limit overrides if I missed any in the above list.

Peter
 [2003-03-27 02:08 UTC] lampa at brutusmud dot net
I have similar problem. I need in one directory enable upload 
larger files (tens of MB) - i can change vi .htaccess directive 
upload_max_filesize to 100M but can't change in any way 
(except php.ini) post_max_size directive. I tried these values: 
102M, 100000000 in .htaccess, httpd.conf but no effect. In 
docs 
(http://www.php.net/manual/en/configuration.directives.php) 
you can found that this variable can be set in .htaccess or 
httpd.conf (and php.ini ...). Bug or feature ?
 [2003-05-27 08:15 UTC] phpmail at jawbone dot freeserve dot co dot uk
http://www.php.net/manual/en/configuration.directives.php

claims that the upload_max_filesize directive accepts an integer (with a handy link to the definition of integer).

http://www.php.net/manual/en/language.types.integer.php

defines an integer as "a number of the set Z = {..., -2, -1, 0, 1, 2, ...}", and that "integers can be specified in decimal (10-based), hexadecimal (16-based) or octal (8-based) notation, optionally preceded by a sign (- or
+)".

The "8M" notation is not a valid integer, and additionally it is not defined anywhere in the manual. Is "M" 1 million or 1024^2? "K" is mentioned nowhere, as far as I can tell.
 [2004-08-05 07:25 UTC] philip@php.net
This is now closed, K and M have now been documented.  Here are the changes:

 http://marc.theaimsgroup.com/?l=phpdoc&m=109168160715454

Leaving type as integer.

 


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC