为什么我的服务器不接受大于2MB的文件?
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!
我有一台运行XAMPP的VPS,并为我制作的iPhone App提供服务。 p>
我使用 ASIHTTPRequest strong>将文件上传到服务器。 p>
应用程序将文件发送到服务器,服务器只接受那些打火机的人 那么2MB。 p>
我还检查了Wireshark并发现了这个警告: p>
PHP致命错误:超过60秒的最大执行时间 第2行中的c:/xxx/index.php strong> p>
我在第2行写道: session_start(); strong> p>
\ n 在我的理论中,它们阻止了大文件进入我的服务器: p>
我真的需要帮助。 谢谢! p>
div>
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
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.
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);?>
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