dp6319
2013-02-06 16:38
浏览 99
已采纳

为什么我的服务器不接受大于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:

  1. Some kind of file size limit
  2. Some kind of time limit per action

I really need help on this one. Thanks!

图片转代码服务由CSDN问答提供 功能建议

我有一台运行XAMPP的VPS,并为我制作的iPhone App提供服务。

我使用 ASIHTTPRequest 将文件上传到服务器。

应用程序将文件发送到服务器,服务器只接受那些打火机的人 那么2MB。

我还检查了Wireshark并发现了这个警告:

PHP致命错误:超过60秒的最大执行时间 第2行中的c:/xxx/index.php

我在第2行写道: session_start(); \ n

在我的理论中,它们阻止了大文件进入我的服务器:

  1. 某种文件大小限制
  2. 每个动作的某种时间限制

    我真的需要帮助。 谢谢!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • ds0678 2013-02-06 16:43
    已采纳

    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
    
    点赞 打赏 评论
  • doutang1873 2013-02-06 16:44

    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.

    点赞 打赏 评论
  • dongyikong6207 2013-02-06 16:45

    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);?>

    点赞 打赏 评论
  • douhao2026 2013-02-06 16:47

    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

    点赞 打赏 评论

相关推荐 更多相似问题