The file exceeds the limit set in the upload_max_filesize in php.ini

June 29, 2016 737 views
Applications PHP CentOS

I'm the problem where I'm using the sentora platform, but when I do upload the theme appears The file exceeds the limit Set in the uploadmaxfilesize in php.ini which is the way to fix it? Sorry English. Brazil

2 Answers

Hi there!

No problem. What you would want to do is, edit your php.ini file. Typically that would be housed in /etc/php5/php.ini, if not there you can run php -i |grep php.ini to find the loaded configuration file.

Once you have found the correct PHP configuration file, you would want to edit the line that says:

postmaxsize
uploadmaxsize

Increase the size of which you would like to utilize, feel free to allow it to be a bit larger than what your file you are having trouble uploading is. You'll lastly want to save the phi.ini file, after making these changes. Lastly, re-attempt at uploading your file.

  • Hello friend thank you for your reply, but can you tell me what is the command to run in putty

    • Sorry guys, answering this one in portuguese...

      Oi Cristiano,

      Você tem que se logar no shell via ssh.
      Para achar o arquivo php.ini instale o programa mlocate com o comando:
      sudo yum -y install mlocate
      depois atualize o banco de dados do mlocate com o comando:
      sudo updatedb
      Para achar o arquivo use o comando:
      locate php.ini
      Na minha máquina, Centos 7, está em:
      /etc/php.ini

      Para editar o arquivo use o comando:
      sudo vi /etc/php.ini

      Você tem que procurar estas linhas:

      maxpostsize = 10M
      uploadmaxfilesize = 10M

      e trocar pelo valor que achar conveniente.

      Para achar a linha dentro do vi use o comando:
      /uploadmaxfilesize

      Ele acha a linha e marca o texto..
      para editar a linha aperte a tecla "i" e o vi entra no modo de edição:

      Substitua os valores desejados, por exemplo:
      uploadmaxfilesize = 20M

      Para salvar as alterações e sair do programa aperte:
      Esc

      e depois..

      :wq

      Se você está usando o Apache acho que você tem que reiniciar depois...

      sudo service httpd restart

      Abraço

      • Hello Friend! eduardobaena

        I installed with this commands but errors occurred

        sudo yum -y install mlocate
        Loaded plugins: fastestmirror
        Setting up Install Process
        Loading mirror speeds from cached hostfile
        epel/metalink | 11 kB 00:00

        • epel: mirror.prgmr.com base | 3.7 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package mlocate.x86_64 0:0.22.2-6.el6 will be installed --> Finished Dependency Resolution

        Dependencies Resolved

        =============================================================================================================================

        Package Arch Version Repository Size

        Installing:
        mlocate x86_64 0.22.2-6.el6 base 86 k

        Transaction Summary

        Install 1 Package(s)

        Total download size: 86 k
        Installed size: 279 k
        Downloading Packages:
        mlocate-0.22.2-6.el6.x8664.rpm | 86 kB 00:00
        Running rpm
        checkdebug
        Running Transaction Test
        Transaction Test Succeeded
        Running Transaction
        error: Couldn't fork %pre(mlocate-0.22.2-6.el6.x86
        64): Cannot allocate memory
        Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x8664
        error: install: %pre scriptlet failed (2), skipping mlocate-0.22.2-6.el6
        Verifying : mlocate-0.22.2-6.el6.x86
        64 1/1

        Failed:
        mlocate.x86_64 0:0.22.2-6.el6

        Complete!
        [root@BLOGUY-99painel ~]# sudo updatedb
        sudo: updatedb: command not found
        [root@BLOGUY-99painel ~]# locate php.ini
        -bash: locate: command not found
        [root@BLOGUY-99painel ~]# Total download size: 86 k
        Installed size: 279 k
        -bash: Total: command not found
        [root@BLOGUY-99painel ~]# Installed size: 279 k
        -bash: Installed: command not found
        [root@BLOGUY-99painel ~]# Downloading Packages:
        -bash: Downloading: command not found
        mlocate-0.22.2-6.el6.x8664.rpm | 86 kB 00:00
        [root@BLOGUY-99painel ~]# mlocate-0.22.2-6.el6.x86
        64.rpm | 86 kB 00:00
        Running Transaction Test
        -bash: 86: command not found
        -bash: mlocate-0.22.2-6.el6.x8664.rpm: command not found
        [root@BLOGUY-99painel ~]# Running rpm
        checkdebug
        -bash: Running: command not found
        [root@BLOGUY-99painel ~]# Running Transaction Test
        -bash: Running: command not found
        [root@BLOGUY-99painel ~]# Transaction Test Succeeded
        -bash: Transaction: command not found
        [root@BLOGUY-99painel ~]# Running Transaction
        -bash: Running: command not found
        [root@BLOGUY-99painel ~]# error: Couldn't fork %pre(mlocate-0.22.2-6.el6.x86
        64): Cannot allocate memory

        Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x8664
        error: install: %pre scriptlet failed (2), skipping mlocate-0.22.2-6.el6
        Verifying : mlocate-0.22.2-6.el6.x86
        64 1/1

        Failed:
        mlocate.x8664 0:0.22.2-6.el6
        Total download size: 86 k
        Installed size: 279 k
        Downloading Packages:
        mlocate-0.22.2-6.el6.x86
        64.rpm | 86 kB 00:00
        Running rpmcheckdebug
        Running Transaction Test
        Transaction Test Succeeded
        Running Transaction
        error: Couldn't fork %pre(mlocate-0.22.2-6.el6.x8664): Cannot allocate memory
        -bash: syntax error near unexpected token `('
        Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x86
        64
        [root@BLOGUY-99painel ~]# Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x8664
        Verifying : mlocate-0.22.2-6.el6.x86
        64 1/1

        -bash: Error: command not found
        [root@BLOGUY-99painel ~]# error: install: %pre scriptlet failed (2), skipping mlocate-0.22.2-6.el6
        -bash: syntax error near unexpected token `('
        mlocate.x8664 0:0.22.2-6.el6
        [root@BLOGUY-99painel ~]# Verifying : mlocate-0.22.2-6.el6.x86
        64 1/1
        -bash: Verifying: command not found
        [root@BLOGUY-99painel ~]#
        [root@BLOGUY-99painel ~]# Failed:
        -bash: Failed:: command not found
        [root@BLOGUY-99painel ~]# mlocate.x8664 0:0.22.2-6.el6
        -bash: mlocate.x86
        64: command not found
        [root@BLOGUY-99painel ~]# ^C
        [root@BLOGUY-99painel ~]#

Hello Friend! eduardobaena

I installed with this commands but errors occurred

sudo yum -y install mlocate
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink | 11 kB 00:00

  • epel: mirror.prgmr.com base | 3.7 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package mlocate.x86_64 0:0.22.2-6.el6 will be installed --> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================

Package Arch Version Repository Size

Installing:
mlocate x86_64 0.22.2-6.el6 base 86 k

Transaction Summary

Install 1 Package(s)

Total download size: 86 k
Installed size: 279 k
Downloading Packages:
mlocate-0.22.2-6.el6.x8664.rpm | 86 kB 00:00
Running rpm
checkdebug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
error: Couldn't fork %pre(mlocate-0.22.2-6.el6.x86
64): Cannot allocate memory
Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x8664
error: install: %pre scriptlet failed (2), skipping mlocate-0.22.2-6.el6
Verifying : mlocate-0.22.2-6.el6.x86
64 1/1

Failed:
mlocate.x86_64 0:0.22.2-6.el6

Complete!
[root@BLOGUY-99painel ~]# sudo updatedb
sudo: updatedb: command not found
[root@BLOGUY-99painel ~]# locate php.ini
-bash: locate: command not found
[root@BLOGUY-99painel ~]# Total download size: 86 k
Installed size: 279 k
-bash: Total: command not found
[root@BLOGUY-99painel ~]# Installed size: 279 k
-bash: Installed: command not found
[root@BLOGUY-99painel ~]# Downloading Packages:
-bash: Downloading: command not found
mlocate-0.22.2-6.el6.x8664.rpm | 86 kB 00:00
[root@BLOGUY-99painel ~]# mlocate-0.22.2-6.el6.x86
64.rpm | 86 kB 00:00
Running Transaction Test
-bash: 86: command not found
-bash: mlocate-0.22.2-6.el6.x8664.rpm: command not found
[root@BLOGUY-99painel ~]# Running rpm
checkdebug
-bash: Running: command not found
[root@BLOGUY-99painel ~]# Running Transaction Test
-bash: Running: command not found
[root@BLOGUY-99painel ~]# Transaction Test Succeeded
-bash: Transaction: command not found
[root@BLOGUY-99painel ~]# Running Transaction
-bash: Running: command not found
[root@BLOGUY-99painel ~]# error: Couldn't fork %pre(mlocate-0.22.2-6.el6.x86
64): Cannot allocate memory

Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x8664
error: install: %pre scriptlet failed (2), skipping mlocate-0.22.2-6.el6
Verifying : mlocate-0.22.2-6.el6.x86
64 1/1

Failed:
mlocate.x8664 0:0.22.2-6.el6
Total download size: 86 k
Installed size: 279 k
Downloading Packages:
mlocate-0.22.2-6.el6.x86
64.rpm | 86 kB 00:00
Running rpmcheckdebug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
error: Couldn't fork %pre(mlocate-0.22.2-6.el6.x8664): Cannot allocate memory
-bash: syntax error near unexpected token `('
Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x86
64
[root@BLOGUY-99painel ~]# Error in PREIN scriptlet in rpm package mlocate-0.22.2-6.el6.x8664
Verifying : mlocate-0.22.2-6.el6.x86
64 1/1

-bash: Error: command not found
[root@BLOGUY-99painel ~]# error: install: %pre scriptlet failed (2), skipping mlocate-0.22.2-6.el6
-bash: syntax error near unexpected token `('
mlocate.x8664 0:0.22.2-6.el6
[root@BLOGUY-99painel ~]# Verifying : mlocate-0.22.2-6.el6.x86
64 1/1
-bash: Verifying: command not found
[root@BLOGUY-99painel ~]#
[root@BLOGUY-99painel ~]# Failed:
-bash: Failed:: command not found
[root@BLOGUY-99painel ~]# mlocate.x8664 0:0.22.2-6.el6
-bash: mlocate.x86
64: command not found
[root@BLOGUY-99painel ~]# ^C
[root@BLOGUY-99painel ~]#

  • I don't know why you are getting this error. Try to skip this step and edit the file directly:

    sudo vi /etc/php.ini

    • Hello Friend! eduardobaena

      still can not solve. Thank you for your attention

      sudo vi /etc/php.ini
      udo vi /etc/php.ini

      http://www.php.net/manual/en/configuration.file.php
      PHP]

      ;;;;;;;;;;;;;;;;;;;
      ; About php.ini ;
      ;;;;;;;;;;;;;;;;;;;
      ; PHP's initialization file, generally called php.ini, is responsible for
      ; configuring many of the aspects of PHP's behavior.

      ; PHP attempts to find and load this configuration from a number of locations.
      ; The following is a summary of its search order:
      ; 1. SAPI module specific location.
      ; 2. The PHPRC environment variable. (As of PHP 5.2.0)
      ; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
      ; 4. Current working directory (except CLI)
      ; 5. The web server's directory (for SAPI modules), or directory of PHP
      ; (otherwise in Windows)
      ; 6. The directory from the --with-config-file-path compile time option, or the
      ; Windows directory (C:\windows or C:\winnt)
      ; See the PHP docs for more specific information.
      ; http://www.php.net/manual/en/configuration.file.php

    • I am seeing that you can open the file. Can you edit it? Try to find the line inside vi with the command:
      /uploadmaxsize
      Justo to clarify, the above command is "forward slash + upload + underscore + max + underscore + size" . I don't know why the underscore character was not printed in my initial post.

      • Hello friend I can't edit php.ini

        • Sorry, my mistake, the correct command to find the line (Centos 7) is:
          /uploadmaxfilesize
          Justo to clarify, the above command is "forward slash + upload + underscore + max + underscore + filesize" (without the double quotes and plus sign)

          • Hello brother thank you for your patience! solve the problem by winscp increased capacity and get everything perfect

            phpvalue uploadmax_filesize 50000000

Have another answer? Share your knowledge.