Viewed   131 times

When trying to upload a PDF file that was 15mb through an admin area created for doing so, nothing happened. There was no success or error message, but the PDF did not upload.

I then thought that it could be an issue with the php.ini settings. Sure enough, when I looked at the file, I found that the limits were set to 8m. Which I'm assuming means 8mb.

post_max_size: http://php.net/post-max-size

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
post_max_size = 20M

upload_max_filesize: http://php.net/upload-max-filesize

; Maximum allowed size for uploaded files.
upload_max_filesize = 20M

Looking at the comments, it appears that one is for files being uploaded, while the other relates directly to POST data. What I'm confused about is this scenario: If you have a form that is POST'ing an image to another page, what does that count as, upload_max_filesize or post_max_size? Does it fall under both? Does one take precedence? Are there cases where one would be used and not the other?

Edit:

So if I have a form that has 3 file inputs, all allowing files 20mb or smaller, the settings would have to be set like so:

upload_max_filesize = 20M
post_max_size = 60M

 Answers

5

You are correct. post_max_size is the maximum size for all POST body data. It doesn't matter if you're POSTing JSON or your DVD collection, this is all POST body data. Your file upload counts towards this limit. You should also be aware that if you are uploading multiple files, the total file size has to fit within this limit.

upload_max_filesize is a maximum size only for files that are POSTed. Other types of POST body data are not subject to this limit.

In short, if you want to upload large files, you must increase both limits.

Wednesday, September 21, 2022
5

In a relative URI, there is no difference between them.

Going without the ./ will save you 2 bytes, so it is marginally better.


In a UNIX style shell, leaving the ./ off will search $PATH while including it will search the current directory. Some people might be including the ./ out of habit from working on the shell.

Monday, November 7, 2022
 
knweiss
 
5

Here's what worked best for me when trying to script this (in case anyone else comes across this like I did):

$ pecl -d php_suffix=5.6 install <package>
$ pecl uninstall -r <package>

$ pecl -d php_suffix=7.0 install <package>
$ pecl uninstall -r <package>

$ pecl -d php_suffix=7.1 install <package>
$ pecl uninstall -r <package>

The -d php_suffix=<version> piece allows you to set config values at run time vs pre-setting them with pecl config-set. The uninstall -r bit does not actually uninstall it (from the docs):

vagrant@homestead:~$ pecl help uninstall
pecl uninstall [options] [channel/]<package> ...
Uninstalls one or more PEAR packages.  More than one package may be
specified at once.  Prefix with channel name to uninstall from a
channel not in your default channel (pecl.php.net)

Options:
  ...
  -r, --register-only
        do not remove files, only register the packages as not installed
  ...

The uninstall line is necessary otherwise installing it will remove any previously installed version, even if it was for a different PHP version (ex: Installing an extension for PHP 7.0 would remove the 5.6 version if the package was still registered as installed).

Monday, December 12, 2022
1

using setHeader you set key vale pair without worrying about there formatting e.g

$this->getResponse()->setHeader('Content-type','json');

while in case of setRawHeader() you put the whole/full header as it is with proper formating

Monday, November 7, 2022
 
4

Never used any of those, but they look interesting..

Take a look at Gearman as well.. more overhead in systems like these but you get other cool stuff :) Guess it depends on your needs ..

Friday, November 11, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :