douzhuo2002
2018-09-18 18:19
浏览 161

无法在php 5中查看move_uploaded_file()的错误输出

I am testing an internal website with this code:

if (move_uploaded_file($_FILES[$file_array_name]['tmp_name'], $target))
       {
             some code......

             header("Refresh: 2; url=some url");
       }
       else
       {

           ini_set('display_errors', 1);
           ini_set('display_startup_errors', 1);
           error_reporting(-1);
           print_r(error_get_last());
           echo "Sorry, there was a problem uploading your file.";
       }
}

When I run it, I can see the echo statement but none of the errors.

Here's the settings for my php.ini:

php --info | grep "error"

    display_errors => STDOUT => STDOUT
    display_startup_errors => On => On
    error_append_string => no value => no value
    error_log => no value => no value
    error_prepend_string => no value => no value
    error_reporting => 24575 => 24575
    html_errors => Off => Off

The file that is causing the error is 305MB, and it works for smaller sized files. So I was wondering if that was the error..

Here are some more values from php.ini:

memory_limit = 400M
upload_max_filesize = 400M
post_max_size = 400M
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dougaojue8185 2018-09-18 18:30

    Try with this error_reporting(E_ALL); after ini_set('display_errors', 1);

    However, this doesn't make PHP to show parse errors - the only way to show those errors is to modify your php.ini with this line:

    display_errors = on

    ref: How do I get PHP errors to display?

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题