I am trying to modify existing PHP code, mySQL database and server settings (php.ini and .htaccess) at GoDaddy to allow for uploads in excess of 20MB (new limit will be 30M). Currently, when I upload anything larger than 8MB, the PHP code apparently executes (I know this because there is an update query that shows the result of the upload), no errors are reported from PHP, mySQL or the server, but nothing is uploaded either.
I have set the following parameters in the php.ini file:
memory_limit = 100M
post_max_size = 30M
file_uploads = On
upload_max_filesize = 30M
max_execution_time = 0
max_input_time = 0
my .htaccess file says
LimitRequestBody 0
My PHP code works well for files under 8 MB but I am having trouble figuring out why anything over that is not happening at all. I checked the file upload location (I physically upload the file to the server's filesystem before I insert/update the data into mySQL) and the files over 8MB never make it. So my guess is that this is where it fails.
Anyone have an idea what I am missing?
Thanks in advance for any input.
M
EDIT:
OK - feel free to award me the dufus badge! I am working in php5. The friggin php.ini file (at least on this server - don't know if this is true of other servers) only works for versions below 5. For version 5 you have to use php5.ini.
As per the GoDaddy support document: http://help.godaddy.com/article/1475
On MySQL side, there is max_allowed_packet variable that limits size of single request, e.g the size of SQL query. You can set it to 50MB or so in your case.
Use a phpinfo file to check for definite what the limits are. Just make a file with the following contents and call it whatever you like (with php extension...):
<?php phpinfo(); ?>
According to this post (http://wordpress.org/support/topic/upload_max_filesize-increase-on-godaddy) you need to add another line to your .htaccess:
suPHP_ConfigPath php.ini
Related
I have an AWS ec2 server setup which is running php 5.6.40 and has following settings
max_execution_time : 3000
max_file_uploads : 50
max_input_time : 600
max_input_vars : 1000
post_max_size : 1000M
upload_max_filesize : 100M
but the file upload is not working. I have putted a simple die in the controller function which displayed when small files are uploaded. but shows ERR_CONNECTION_RESET when using large files greater than 324KB.
I have debugged the code fully it has some conditions in most situations if the file is uploaded successfully within 25-30 seconds the later code runs successfully if the internet is little fluctuating and not able to upload 324KB it shows me an error for that also. I have also checked there is nothing wrong with the code it is working fine on other server.
I have fetched the values of ini in the PHP code so that I get the exact value after overwrite through ini_get_all()
Got the solution the issue is with the apache. I have apache 2.4.39 installed and it is not including the setting in the httpd.conf in installation so need to put it manually and restart the server.
RequestReadTimeout header=20-40, MinRate=500 body=20, MinRate=500
Thanks to the AWS support for this help.
I am developing a web application which will allow the administrator to upload a file and its max size is 500M.
I have changed the post_max_size = 500M and upload_max_filesize = 500M from 32M but the funny thing is that it does not allow me to upload files greater than 32M still.
I have restarted the server and everything and still cant get to upload a large file.
Is there any other setting i should change to allow me to upload the file?
I am not going to process the file in memory but move it to the tmp folder and than process from there with move_uploaded_file so memory_limit i am assuming that is not going to be affected.
It is a simple form and as i recall if the limit is exceeded in the $_FILES superglobal array i should see something in the error element of the array but instead i get an empty array.
EDIT: I am modifying the php.ini settings but from phpinfo i am still getting the sizes of 32MB. And the php error log says that obviously i am exceeding 32MB
Can you please help me out.
Thanks
Chech phpinfo() on a web page, see which php.ini is loaded. You could be editing the wrong file.
Sometimes different ini files get loaded for command line and apache server use
I fount out what the problem is:
I am using MAMP as a developing server and MAMP has templates which override the original every time the server starts (a stupid thing IMO) so you need to change the template for it to take effect!
The template can be found under /Applications/Mamp Pro/Contents/Resources
And there many php ini files for every version will be found.
Hope this helps to the next one!
I configured PHP and lighttpd to take a maximum of 9MB a couple weeks back and it worked perfectly fine. I used the following lines:
php.ini: upload_max_filesize = 9000
lighttpd.conf: server.max-request-size = 9000
Now I need to support uploading files of up to 16MB. So, I changed the files to the following:
php.ini: upload_max_filesize = 16000
lighttpd.conf: server.max-request-size = 16000
It does not work properly. It is supposed to upload the files to /tmp/tmp in pieces, then reconstructs them into one in /tmp. The pieces go into /tmp/tmp but are never rebuilt, just deleted. Does anyone have any idea why?
You were probably assuming that the PHP config value is in kbytes. According to the PHP documentation for upload_max_filesize, it is in bytes.
See http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize, which states:
upload_max_filesize - integer
The maximum size of an uploaded file. When an integer is used, the
value is measured in bytes.
Also refer to the PHP FAQ for other values that you can use for this and other config values:
http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
I have a simple PHP script. Its used to upload users into the joomla tables. Basically it uploads users into joomla three main tables.
The PHP uploader sript works fine when the CSV is about 80MB to 100 MB.
It does not work or just nothing happens when the file size is 500MB or above.
How do i make the PHP script work to upload the CSV files of over 500 MB?
Do i actually change something in my PHP.ini settings or is there something else i could
add in the script itself.
Thanks in Advance.
in the .htcaccess file add the following:
php_value upload_max_filesize 500M
php_value post_max_size 500M
in php.ini add:
upload_max_filesize = 500M
post_max_size = 500M
You have to change the upload_max_filesize in php.ini
I had the same issue long time ago with rails and mysql,
You have to consider 3 things when you want to upload a file:
Max upload file in PHP
Be sure that MySQL will save a big file.
Your browser will lost connection after a while uploading a file to your database if it don't receive any answer from the server.
I think that You handled the first 2, but to handle the 3rd probably you will need a upload progress bar to keep the session active. Actually you need some AJAX to keep the server and the client "talking" meanwhile the file still uploading.
I am trying to upload large files through my cms and was wondering how to change the php.ini file for heart internet.
Is this possible in shared hosting, if not are there any other work arounds?
Thanks in Advance
To override settings all you need to do is create either a php.ini or php5.ini file (if you are running PHP5) in your root directory. Then you can change settings like this:
upload_max_filesize = 20M ;
post_max_size = 20M ;
max_execution_time = 60 ;
This gives you maximum file size of 20MB and 60 second timeout.
As long as you keep this size within the allowed limits on your account, you can use this to increase the default size - which is 5MB.
It depends on whether your web hosting company allows you to override certain PHP settings or not. It might be possible to change some values but not others.
Secondly, the process for overriding settings differs depending on whether your hosting is IIS or Apache. If its Apache, try adding these two lines to your .htaccess file:
php_value upload_max_filesize 8M
php_value post_max_size 8M
This .htaccess file should do to the directory where your php upload script resides, or higher. I'd rather put it in the root directory.
Once done, create a php page containing this code:
<?php phpinfo( ); ?>
Compare the Local Value and Master Value of these settings to see if the changes are in effect.
There is no way to upload files over 50MB without breaking your terms and getting your account shutdown.
However if the terms were different, you could split the file into parts and join them together on the server side.
I moved away from heart internet and got my own server for this exact reason as they wouldn't even let me pay a premium to get the restriction removed (restricted from there end I think)
If it is shared hosting you probably won't be able to, I have also discovered that you cannot use ini_set to set the correct settings because the file upload occurs before your script is executed. So if you want to accept large files via a form to a PHP script you have to use php.ini.
You might be a work around though, you could use an open FTP account, upload large files form there and code a bit of script to ask the user what file they have uploaded, then you can manipulate (move / rename) to your hearts content.