This question already has answers here:
How to upload large files above 500MB in PHP [duplicate]
(3 answers)
Closed 6 years ago.
if(trim($_FILES["fileUpload"]["name"][$j]) != "")
{
move_uploaded_file($_FILES["fileUpload"]["tmp_name"][$j],"../../../../uploads/msg_attachment/".time()."_".$_FILES["fileUpload"]["name"][$j]);
}
upload_max_filesize 128M
max_file_uploads 20
Getting no error .Please help
I think Brijal Savaliya is right, you change the POST_MAX_SIZE along with MAX_EXECUTION_TIME etc to higher values, you can do this by two ways...
Use PHP Code
Change PHP.ini
By PHP Code
//You can write a code to change this value by function
ini_set('POST_MAX_SIZE',128M);
ini_set('MAX_EXECUTION_TIME ',300);
Edit in PHP.ini file
POST_MAX_SIZE = 128M
MAX_EXECUTION_TIME = 300
Related
This question already has answers here:
Can't import database through phpmyadmin file size too large
(13 answers)
Can not increase file upload size WAMP
(4 answers)
Closed 4 years ago.
I can only upload files up to 128 MB big on Phpmyadmin. I need to change the value, so I tried to change the php.ini file via tray.
I already changed memory_limit = 128M to memory_limit = 2048M and restarted all services, but the limit in Phpmyadmin is still 128 MB.
Do I have to change another setting?
Update:
I figured out that you can also set it directly via the tray menu, but it makes no difference (restarted already):
Interestingly there is still 128M selected even after I changed it to 2048M in the php.ini. I set it to 2048M again via the tray menu.
memory_limit = 2048M
post_max_size = 2048M
upload_max_filesize = 2048M
max_execution_time = 300
max_input_time = 300
Made no difference.
The duplicate 'Can not increase file upload size WAMP' solved the problem.
Ive spent hours on an iOS upload request to a PHP script trying to figure out why the _POST and _FILES values were empty at the PHP script side.
I finally figured out that anything I send OVER about 15K bytes (Content-Length) is the problem. Anything under this amount shows my _POST and _FILES coming through as expected. I also only sending 3 _POST vars and 1 File at a time.
My question is what variable(s) in my php.ini script might cause this?
I have the following php.ini variables set to:
post_max_size = 1M
file_uploads = On
max_file_uploads = 1
memory_limit = 40M
upload_max_filesize = 1M
Ive tried increasing each as well with the same result.
Thanks in advance!
post_max_size = 1M and
upload_max_filesize = 1M should be the options, check php_info if your changes has been loaded
maybe this is server setting, in apache there is directive LimitRequestBody for that
This question already has answers here:
Best way to manage long-running php script?
(16 answers)
Closed 5 years ago.
I'm trying to download a file from a remote server with file_put_contents. This script is called via ajax. The problem i'm having is the script timeout when the file is large e.g. (500mb). I get 504 Gateway Timeout - nginx
download.php
$destination = "/home/mywebsite/public_html/wp-content/channels/videos/test.mp4";
$link = "http://www.example.com/videos/movie.mp4"; //500mb
$result = file_put_contents($destination, fopen($link, 'r'));
I'm using dedicated hosting. I've changed my php.ini and confirmed in phpinfo();
max_execution_time 7200
max_input_time 7200
max_input_vars 1000
memory_limit -1
output_buffering 4096
post_max_size 1200M
upload_max_filesize 1000M
This script keeps timing out. Is there another solution how do i solve? When i check the directory the file is successfully downloaded but the page times out. So i can't return any data via ajax.
How do i solve?
You should also change nginx fcgi timeout values. PHP script continues executing but your connection between nginx and PHP timeouts.
Make download asynchronous. Like one process only fill some DB or rabbitMq with download requests and other wil cosume it (maybe cron)
This question already has answers here:
Best way to manage long-running php script?
(16 answers)
Closed 9 years ago.
I have a php script that will surely take very long time to process. Is it good to have it in set_time_limit(0); I have seen some times even when we set time limit to 0 we get 500 internal server error. What is best way to handle such long time consuming script in php?
If you try to execute a long running script from the browser, you have a chance of running into all sorts of timeouts, from php, proxies, web servers and browsers. You may not be able to control all of them.
Any long running script should be run from the command line. That way you take out all of the problems except for the php execution time limit which is easy to override.
If you have access to php.ini file then set max_execution_time in it like
max_execution_time = 300
or you can user .htaccess to handle it like
php_value max_execution_time 300
Script which runs more than 360 seconds(I hope max_execution_time) will throw an Internal server error automatically even set_time_limit is applied.
You can have this in your page.
<?php
ini_set('max_input_time', time in seconds);
ini_set('max_execution_time', time in seconds);
?>
or in php.ini
set max_input_time and max_execution_time whatever you like.
or in .htaccess
php_value max_input_time 300
php_value max_execution_time 300
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
POST Content-Length exceeds the limit
PHP Warning: POST Content-Length of 113 bytes exceeds the limit of -1988100096 bytes in Unknown
I have form for upload images, I testing and if I upload image, where have for example 9 mb size, php returns error:
POST Content-Length of 10194008 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
I want that dont upload files more than 2 mb, in first line I have this code:
if (!empty($_FILES['main_photo']['name'])) {
if ( $_FILES['main_photo']['size'] > 1024 * 1024 * 2 ) {
header("Location: index.php");
exit();
}
}
but this error still displayed, please tell what make, I want if file more than 2 mb, just:
header("Location: index.php");
In php.ini look for upload_max_filesize and post_max_size and set to a suitable size:
upload_max_filesize = 20M
post_max_size = 20M
Only after that changes you can add your redirection code.
If you can't access your php.ini (shared hosting) try in .htaccess:
php_value upload_max_filesize 20M
php_value post_max_size 20M
The file you are trying to upload is larger than the configured size set in php.ini. Go inside of php.ini and modify these values to 2mb or greater to allow larger uploads:
upload_max_filesize
post_max_size <-- This one appears to be your biggest issue
Then your code should work.
Your server probably has setting to limit size to 8 megabytes, I think you code is ok. its a server problem try setting the upload_max_filesize using ini_set to something more. If you are one a commercial server , not your own, try contacting administrator