问题
I have a VPS that runs XAMPP and gives service to an iPhone App that I made.
I used ASIHTTPRequest to upload files to the server.
The App sends files to the server, and the server accept only those who are lighter then 2MB.
I also checked with Wireshark and found this warning:
PHP Fatal error: Maximum execution time of 60 seconds exceeded in c:/xxx/index.php in line 2
in line 2 I wrote: session_start();
in my theory they are 2 things that block big files from entering my server:
- Some kind of file size limit
- Some kind of time limit per action
I really need help on this one. Thanks!
回答1:
Check the settings in your php.ini
file which, when running XAMPP, can be found in the *root*/php/
directory.
#Make sure file uploads are turned on
file_uploads = On
#Change the max upload size to 100Mb
upload_max_filesize = 100M
#Change the max post size to 100Mb
post_max_size = 100M
#Change the max upload time to 900seconds
max_input_time = 900
#This is where you are seeing your problem as the script execution is timing out.
#Change the max execution time of the script to 900 seconds
max_execution_time = 900
回答2:
Check the following lines in your php.ini
file:
upload_max_filesize = 2M
max_execution_time = 300
You might have to restart your server afterwards.
回答3:
The error says: Maximum execution time of 60 seconds exceeded
This makes me think that your internet-connection is slow, thus the upload is taking more than the max_execution_time
To see what the max_execution_time
currently is:
$maxtime = ini_get(max_execution_time);
echo $maxtime;
To make the max_execution_time
bigger for the current page, enter this line on top of your PHP-file:
ini_set("max_execution_time", 600);?>
回答4:
Put at the topo of your index.php:
<?php
ini_set('max_execution_time', 180); //Put the number of seconds that you want
The upload_max_filesize
can't be change in runtime, so you need to increase this value in your php.ini
来源:https://stackoverflow.com/questions/14734184/why-wont-my-server-accept-files-larger-then-2mb