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

无法在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?

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算