Ad Widget

Collapse

File is too big, max upload size

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andrea.consadori
    Member
    • Apr 2013
    • 94

    #1

    File is too big, max upload size

    Hi,
    i have issue during template import,
    my file is about 3mb and when i try to import under template (zabbix/conf.import.php) i've the issue: File is too big, max upload size is 2097152 bytes.

    i know that this is about a php limitation so i modify the php ini and now the phpinfo file told me

    max_file_uploads 20M
    upload_max_filesize 10M

    i restart apache2 but the issue persist... what i miss?
  • mattrk
    Junior Member
    • Mar 2014
    • 18

    #2
    Were you able to fix this? I'm running into the same problem. I've also upped the limit in php.ini and restarted. Still says the max upload size is 2097152 bytes.

    Comment

    • mattrk
      Junior Member
      • Mar 2014
      • 18

      #3
      Any help? I really want to start using Zabbix but this is a pretty big hurdle for me. Unless i can figure it out i'm going to have to go back to Zenoss.

      Comment

      • steveboyson
        Senior Member
        • Jul 2013
        • 582

        #4
        /usr/share/zabbix/include/classes/class.frontendsetup.php: const MIN_PHP_UPLOAD_MAX_FILESIZE = 2097152; // 2*1024*1024

        Comment

        • mattrk
          Junior Member
          • Mar 2014
          • 18

          #5
          Originally posted by steveboyson
          /usr/share/zabbix/include/classes/class.frontendsetup.php: const MIN_PHP_UPLOAD_MAX_FILESIZE = 2097152; // 2*1024*1024
          Thanks for the hint. However, even after changing that setting, i still can't import the file. The error message still says the max file upload size is 2097152 bytes. Here is what i set it to:

          const MIN_PHP_UPLOAD_MAX_FILESIZE = 4194304; // 4*1024*1024

          Thanks for any other help.

          Comment

          • mattrk
            Junior Member
            • Mar 2014
            • 18

            #6
            Well, i just figured it out. It turned out the zabbix virtual host configuration file had the upload_max_filesize explicitly defined as 2M. (/etc/httpd/conf.d/zabbix.conf) I guess when the virtual host config file defines php settings it overrides the php.ini file. (I should have known that...)

            Anyways, I hope this helps anyone else who runs into this problem.

            Comment

            • jonxor
              Junior Member
              • Jun 2016
              • 24

              #7
              This helped me on my new install of 3.0.9. Thank you.

              I tried changing all of the above things, but the only one that worked was
              changing /etc/apache2/conf-available/zabbix.conf.

              Comment

              • tobby
                Junior Member
                • Oct 2018
                • 1

                #8
                Hey all,
                Didn't help me, unfortunately.
                File is too big, max upload size is 2097152 bytes
                I am using:
                zabbix_server (Zabbix) 4.0.0
                Revision 85308 1 October 2018, compilation time: Oct 1 2018 08:50:48

                and have changed the following:

                /usr/share/zabbix/include/classes//setup/CFrontendSetup.php
                const MIN_PHP_POST_MAX_SIZE = 16777216; // 16*1024*1024
                const MIN_PHP_UPLOAD_MAX_FILESIZE =16777216 ; // 2*1024*1024
                /etc/apache2/conf-available/zabbix.conf
                php_value post_max_size 16M
                php_value upload_max_filesize 16M
                /etc/php/7.0/apache2/php.ini
                post_max_size = 16M
                upload_max_filesize = 16M

                Did I miss something / configure in the wrong areas?
                (I did restart the whole appliance, just to be sure)
                Thanks for any help

                Comment


                • tobby
                  tobby commented
                  Editing a comment
                  Sorry - my bad. Adjusted the values in the PHP5.5 section of "conf-available/zabbix.conf" instead of the 7.0, which is actually running on my server :-/ mi scusi
              • Yasamal33
                Member
                • Sep 2012
                • 42

                #9
                Originally posted by tobby
                Hey all,
                Didn't help me, unfortunately.
                File is too big, max upload size is 2097152 bytes
                I am using:
                zabbix_server (Zabbix) 4.0.0
                Revision 85308 1 October 2018, compilation time: Oct 1 2018 08:50:48

                and have changed the following:

                /usr/share/zabbix/include/classes//setup/CFrontendSetup.php
                const MIN_PHP_POST_MAX_SIZE = 16777216; // 16*1024*1024
                const MIN_PHP_UPLOAD_MAX_FILESIZE =16777216 ; // 2*1024*1024
                /etc/apache2/conf-available/zabbix.conf
                php_value post_max_size 16M
                php_value upload_max_filesize 16M
                /etc/php/7.0/apache2/php.ini
                post_max_size = 16M
                upload_max_filesize = 16M

                Did I miss something / configure in the wrong areas?
                (I did restart the whole appliance, just to be sure)
                Thanks for any help
                Looks like necroposting, but anyways: for appliance > 5.0 it's enough to modify php_value[upload_max_filesize] = 16M in /etc/php-fpm.d/zabbix.conf file.

                Comment

                • FildaSmile
                  Member
                  • Jul 2019
                  • 61

                  #10
                  Hi, im running zabbix 5.2 (installed via packages) thank you for advices it helped me:

                  /usr/share/zabbix/include/classes//setup/CFrontendSetup.php
                  const MIN_PHP_POST_MAX_SIZE = 16777216; // 16*1024*1024
                  const MIN_PHP_UPLOAD_MAX_FILESIZE =16777216 ; // 2*1024*1024
                  /etc/apache2/conf-available/zabbix.conf
                  php_value post_max_size 16M
                  php_value upload_max_filesize 16M
                  /etc/php/7.4/apache2/php.ini
                  post_max_size = 16M
                  upload_max_filesize = 16M
                  Last edited by FildaSmile; 05-01-2021, 09:36.

                  Comment

                  • moneybags
                    Junior Member
                    • May 2021
                    • 3

                    #11
                    Hi,
                    does not work for nginx, even after multiple re-boots.

                    sudo nano /usr/share/zabbix/include/classes/setup/CFrontendSetup.php

                    const MIN_PHP_POST_MAX_SIZE = 16777216; // 16*1024*1024
                    const MIN_PHP_UPLOAD_MAX_FILESIZE =16777216 ; // 2*1024*1024


                    sudo nano /etc/php/7.4/cli/php.ini

                    post_max_size = 50M
                    upload_max_filesize = 20M




                    php -i shows php is set correctly

                    nano /etc/nginx/nginx.conf

                    Http section

                    client_max_body_size 20M;


                    but
                    /etc/zabbix/php-fpm.conf did it

                    Seriously they should get their act together on this......., it is all over the place.

                    Comment

                    • rishi321
                      Junior Member
                      • May 2021
                      • 1

                      #12
                      For anyone else who is stuck, once you make the above changes you may need to run: service php-fpm restart

                      Comment

                      • rihardsshtrauss
                        Junior Member
                        • Nov 2021
                        • 3

                        #13
                        Hello, Everyone,

                        Since I have fund this thread, and it's related to my problem, I would like to add to this in hopes, that somebody can help me with this problem.

                        Configuration at this moment: Ubuntu 20.04 LTS, Zabbix 5.4.5, Postgresql 13 DB with TimescaleDB, Nginx 1.18.0. All installed using Zabbix packages for Ubuntu.

                        Problem: cant upload any file larger than 2Mb or 1 Mb.

                        Cheked every .conf, php .ini file I could find, made changes in all of them, made changes in files separetly, restarted nginx and php7.4-fpm every time after changes have been made. Also tried restarting zabbix server service. No succcess, files are still rejected, if they are larger than 2 Mb and all I get is this error: 413 Request Entity Too Large.

                        I even launched http://zabbixfrontend.com/setup.php and it shows that file size has been changed to 5 Mb.

                        If I check nginx config files, there is nothing that can be added to it, to make larger file upload possible, If I add client_max_body_size xxM; only 1 Mb files are allowed and error ir shown in GUI: File must be less then 1 Mb.

                        If I check php configs, btw, after installation there are 3 php "versions" and 1 service (Service is the only binary that shows different configuration):

                        php -i | grep size
                        post_max_size => 16M => 16M
                        realpath_cache_size => 4096K => 4096K
                        upload_max_filesize => 5M => 5M
                        opcache.max_file_size => 0 => 0

                        php7.4 -i | grep size
                        post_max_size => 16M => 16M
                        realpath_cache_size => 4096K => 4096K
                        upload_max_filesize => 5M => 5M
                        opcache.max_file_size => 0 => 0

                        php-fpm7.4 -i | grep size
                        post_max_size => 8M => 8M
                        realpath_cache_size => 4096K => 4096K
                        upload_max_filesize => 2M => 2M
                        opcache.max_file_size => 0 => 0

                        Services are working with no problems as much as I can find:

                        service php7.4-fpm status
                        ● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
                        Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
                        Active: active (running) since Tue 2021-11-23 13:38:08 EET; 21min ago
                        Docs: manhp-fpm7.4(8)
                        Process: 3210566 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)

                        service nginx status
                        ● nginx.service - A high performance web server and a reverse proxy server
                        Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
                        Active: active (running) since Tue 2021-11-23 13:38:15 EET; 23min ago
                        Docs: man:nginx(8)
                        Process: 3210776 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
                        Process: 3210788 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

                        I have tried all suggestions that were mentioned in this post and made litle seperate changes with no result. Also searched php documentation, nginx documentation, to make sure, that I made correct changes, but files cant be uploaded. Everything that I could find related to this issue in Zabbix manual/documentation is this:

                        Maximum size of the upload file is limited by the value of ZBX_MAX_IMAGE_SIZE that is 1024×1024 bytes or 1 MB.

                        The upload of an image may fail if the image size is close to 1 MB and the max_allowed_packet MySQL configuration parameter is at a default of 1MB. In this case, increase the max_allowed_packet parameter.

                        But since I am not using Mysql, but PostgreSQL, searched for related options in postgresql, didnt find any.

                        Main question, can someone help me with this, or this is expected behavior for nginx with php? If something needs to be changed, where and to what?

                        At this moment, this makes no sense to me anymore... If more information is needed, I can provide it.

                        Rihards

                        Comment

                        • rihardsshtrauss
                          Junior Member
                          • Nov 2021
                          • 3

                          #14
                          Originally posted by rihardsshtrauss
                          Hello, Everyone,

                          Since I have fund this thread, and it's related to my problem, I would like to add to this in hopes, that somebody can help me with this problem.

                          Configuration at this moment: Ubuntu 20.04 LTS, Zabbix 5.4.5, Postgresql 13 DB with TimescaleDB, Nginx 1.18.0. All installed using Zabbix packages for Ubuntu.

                          Problem: cant upload any file larger than 2Mb or 1 Mb.

                          Cheked every .conf, php .ini file I could find, made changes in all of them, made changes in files separetly, restarted nginx and php7.4-fpm every time after changes have been made. Also tried restarting zabbix server service. No succcess, files are still rejected, if they are larger than 2 Mb and all I get is this error: 413 Request Entity Too Large.

                          I even launched http://zabbixfrontend.com/setup.php and it shows that file size has been changed to 5 Mb.

                          If I check nginx config files, there is nothing that can be added to it, to make larger file upload possible, If I add client_max_body_size xxM; only 1 Mb files are allowed and error ir shown in GUI: File must be less then 1 Mb.

                          If I check php configs, btw, after installation there are 3 php "versions" and 1 service (Service is the only binary that shows different configuration):

                          php -i | grep size
                          post_max_size => 16M => 16M
                          realpath_cache_size => 4096K => 4096K
                          upload_max_filesize => 5M => 5M
                          opcache.max_file_size => 0 => 0

                          php7.4 -i | grep size
                          post_max_size => 16M => 16M
                          realpath_cache_size => 4096K => 4096K
                          upload_max_filesize => 5M => 5M
                          opcache.max_file_size => 0 => 0

                          php-fpm7.4 -i | grep size
                          post_max_size => 8M => 8M
                          realpath_cache_size => 4096K => 4096K
                          upload_max_filesize => 2M => 2M
                          opcache.max_file_size => 0 => 0

                          Services are working with no problems as much as I can find:

                          service php7.4-fpm status
                          ● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
                          Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
                          Active: active (running) since Tue 2021-11-23 13:38:08 EET; 21min ago
                          Docs: manhp-fpm7.4(8)
                          Process: 3210566 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)

                          service nginx status
                          ● nginx.service - A high performance web server and a reverse proxy server
                          Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
                          Active: active (running) since Tue 2021-11-23 13:38:15 EET; 23min ago
                          Docs: man:nginx(8)
                          Process: 3210776 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
                          Process: 3210788 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

                          I have tried all suggestions that were mentioned in this post and made litle seperate changes with no result. Also searched php documentation, nginx documentation, to make sure, that I made correct changes, but files cant be uploaded. Everything that I could find related to this issue in Zabbix manual/documentation is this:

                          Maximum size of the upload file is limited by the value of ZBX_MAX_IMAGE_SIZE that is 1024×1024 bytes or 1 MB.

                          The upload of an image may fail if the image size is close to 1 MB and the max_allowed_packet MySQL configuration parameter is at a default of 1MB. In this case, increase the max_allowed_packet parameter.

                          But since I am not using Mysql, but PostgreSQL, searched for related options in postgresql, didnt find any.

                          Main question, can someone help me with this, or this is expected behavior for nginx with php? If something needs to be changed, where and to what?

                          At this moment, this makes no sense to me anymore... If more information is needed, I can provide it.

                          Rihards
                          After long day of extra searching and help from colleagues, all the changes that I had already made were okay and needed, but I was missing one more change in nginx conf. Changes were made in php files: check ini, zabbix php conf files, make changes as needed (for file sizes), make changes in Nginx.conf, in /etc/nginx and in /etc/zabbix, and in /usr/sha.../defines.inc.php, added example for file size up to 5Mb : define('ZBX_MAX_IMAGE_SIZE', 5242880); // Changed from ZBX_MEBIBYTE to 5242880

                          Nginx config files: client_max_body_size xxM;: I was missing this option in /etc/zabbix/nginx.conf, that sems to be the main error, that was made from my side.

                          Almost all settings need to be as already shown in this post, but 2 times in nginx config files. Kinda makes no sense from one side, but if it works after that, it works.

                          I hope that this added information can help somebody as much as it helped me!

                          Rihards

                          Comment

                          • user093123574
                            Junior Member
                            • Sep 2024
                            • 1

                            #15

                            Most Solutions in these Posts didn't work for me with my default installtion from Zabbix for Ubuntu, here my quick solution.

                            Hopefully this helps someone at some point, because I've had the Problem a while ago and now again, during some tests with a 3.2MB big Template.
                            My Test VM has an Ubuntu Server 24.04, Zabbix 6.0, MariaDB and Apache as my Webservice installed, but the solution was the exact same for the older Ubuntu and Zabbix Version.


                            Solution:
                            Edit "/etc/apache2/conf-enabled/zabbix.conf " file, replace the values about maxium Upload Size 2M to whatever you need.
                            In the end i restarted apach2.service and it worked.

                            Comment

                            Working...