Page 1 of 2

Uploading file too large

PostPosted: 19. December 2019 03:07
by doKer
You probably tried to upload a file that is too large

As I see the quote above during importing a test.sql, I did googling and found that I have to change php.ini.

So I changed the php.ini like the following.
before:
post_max_size = 8M
upload_max_filesize = 2M
max_file_uploads = 20
max_execution_time = 30
memory_limit = 128M

after:
post_max_size = 750M
upload_max_filesize = 750M
max_file_uploads = 200
max_execution_time = 300
memory_limit = 1000M


I did shutdown and restart the computer.
but it still says the quote below
You probably tried to upload a file that is too large


As I look closely after I did select import. the following is not changed although I've changed like the before/after quote above in php.ini.
Browse your computer:[browse] (Max: 2,048KiB)


How can I make "import" work?
How can I change (Max:2,048KiB) the quote above?

Re: Uploading file too large

PostPosted: 21. December 2019 04:43
by nemesis

Re: Uploading file too large

PostPosted: 20. April 2020 06:22
by townsbg
I am also experiencing this issue. I changed the size in php.ini but the limit still shows 2 mb. Why?

Re: Uploading file too large

PostPosted: 20. April 2020 16:04
by Nobbie
That was hardcoded in superold phpmyadmin.

Re: Uploading file too large

PostPosted: 20. April 2020 16:42
by Altrea
What is the local and global value of the settings memory_limit, post_max_size and upload_max_filesize in PHPinfo?

Re: Uploading file too large

PostPosted: 20. April 2020 19:00
by townsbg
Currently I'm back to the default.
memory_limit=128M
post_max_size=8M
upload_max_filesize=2M

However I tried changing the max to 512 and when that didn't work I changed all 3. I also tried both the development and production files. If I need to update how do I do so?

Re: Uploading file too large

PostPosted: 20. April 2020 19:23
by townsbg
As per the following instructions I tried the command line:

Nobbie wrote:Try to import your SQL file via mysql interpreter instead of phpmyadmin, thats by far more stable.

In a terminal run mysql approx. like this:

Code: Select all
c:/xampp/bin/mysql -u username -ppassword databasename <exportfile.sql


Be carefully, as you can see, there is a space between "-u" and username, but there is NO space between "-p" and password - thats weird, but correct! If your exportfile.sql (replace with the real file name) already applies a database (you would find a "USE database;" somewhere in the top, you might omit the databasename in the command. There MUST NOT be a space between "<" and the exportfile.sql.

That command will run by far faster than phpmyadmin and its by far more stable. If you use Xampps default setup and apply "root" as Username and leave out the -p Option with passwort (as Password is empty on default installation).


As follows:
Code: Select all
C:\xampp>c:/xampp/mysql/bin/mysql.exe -u <Username> -p<Password> mywiki <Wiki_Database.sql


And I received the following error:
ERROR 2006 (HY000) at line 527: MySQL server has gone away


Is that because of the 2mb limit? Did I get the syntax right?

Re: Uploading file too large

PostPosted: 20. April 2020 19:33
by Altrea
townsbg wrote:I also tried both the development and production files. If I need to update how do I do so?

None of them, these are only templates. That's why I asked what's the values in phpinfo and not what you are thinking you have configured.
The only valid php configuration file by default is named php.ini and even in this file are commented lines that don't change anything if you put in your new values there.

Re: Uploading file too large

PostPosted: 20. April 2020 20:17
by townsbg
Now things are worse. As per this I tried to adjust innodb_lock_wait_timeout & innodb_log_file_size in my.ini. Now I'm getting a blue banner that says "This app can't run on your PC. To find a version for your PC, check with the software publisher." The command prompt line also returns access is denied. Issue persists after restoring the my.ini file from a backup and rebooting the computer. Everything else seems to be working.

I'm running 2012 r2. This is a recovery from a 2008 r2 server.

How do I get the database imported? If I need to update xampp how do I do so?

Re: Uploading file too large

PostPosted: 20. April 2020 20:21
by Altrea
In your position I would restore the last backup I would have made before changing anything that essential.

Re: Uploading file too large

PostPosted: 20. April 2020 21:28
by townsbg
I restored the entire folder and tried an import from the command line. I'm not getting that blue banner anymore nor the access is denied error but I still got the server has gone away error. Do I need to update xampp? If so how?

Re: Uploading file too large

PostPosted: 21. April 2020 06:47
by Altrea
townsbg wrote:As follows:
Code: Select all
C:\xampp>c:/xampp/mysql/bin/mysql.exe -u <Username> -p<Password> mywiki <Wiki_Database.sql


And I received the following error:
ERROR 2006 (HY000) at line 527: MySQL server has gone away


Is that because of the 2mb limit? Did I get the syntax right?

I hope you did repcale <Username> and <Password> with your true credentials, and did not enclose them in the <> brackets...

That is not because of the 2MB limit. The 2MB limit is a limitation of the php configuration. phpmyadmin is written in php so it is affected by php configirations.
The MySQL CLI is only affected by mysql configurations. There are of course still limitations that can produce such behavior.

In your case it can be true that your import contains very very huge sql statements that exceeded the limit for max_allowed_packet. So it might help to increase this limit for the server in your my.ini file and for the client as command parameter --max_allowed_packet. Maximum value for this parameter is 1G which means 1 Gigabyte.

So for your mysql statement it should be append to
Code: Select all
c:/xampp/mysql/bin/mysql.exe --max_allowed_packet=1G -u <Username> -p<Password> mywiki <Wiki_Database.sql

But don't forget to change this value for the server component in the \xampp\mysql\bin\my.ini file in the [mysqld] section too and restart your mysql server after that.

townsbg wrote:Do I need to update xampp? If so how?

How should we answer that? We have no information about your current environment, not even which XAMPP version you are using. We don't know your import file, or your current configuration.
In general: only update if you have a specific issue you already know that an update will solve that or if you have no other options.

Re: Uploading file too large

PostPosted: 21. April 2020 19:32
by townsbg
That is where I put my actual username and password, without the brackets. I tried the root ID, a global admin, and the admin for the actual database.

But don't forget to change this value for the server component in the \xampp\mysql\bin\my.ini file in the [mysqld] section too and restart your mysql server after that.


What do you mean? The last time I tried to edit the my.ini file I (apparently) corrupted my install. Anyway I tried your derivative and it didn't work. I still got the mysql server has gone away error.

How should we answer that? We have no information about your current environment, not even which XAMPP version you are using. We don't know your import file, or your current configuration.
In general: only update if you have a specific issue you already know that an update will solve that or if you have no other options.


Version 5.6.30-1. The import file is only 17.8 mb. I'm not sure how to answer your other questions. Other than setting up a site and changing the passwords I haven't changed a lot from the defaults.

Re: Uploading file too large

PostPosted: 21. April 2020 20:39
by townsbg
I changed max_allowed_packet to 512m and I was able to import the database without any errors. After re-configuring the site it seems to be working. Now I should be able to do the same to the other sites and decomm my old server. Before I head down that path should I update and if so how? Also is that a good size for the max allowed or should it be higher/lower?

Here's: the results of the command:
Code: Select all
C:\xampp>c:/xampp/mysql/bin/mysql.exe -u <username> -p<password> mywiki <Wiki_Database.sql

C:\xampp>

Re: Uploading file too large

PostPosted: 21. April 2020 21:40
by townsbg
Also I see in the php.ini file that the time zone is set for germany. That would explain why the times are always wrong. How do I set it for CST?