PHP Session 上传进度 EMPTY [英] PHP Session upload progress EMPTY

查看:96
本文介绍了PHP Session 上传进度 EMPTY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题被问了数百万次,但我从三天来就一直在与这个问题作斗争,我完全糊涂了.

this question was asked milions of times, but I'm FIGHTING with this problem since three days, and I'm totaly confused.

我无法强制 PHP 在 $_SESSION (http://www.php.net/manual/en/session.upload-progress.php). 我只能得到空会话.

I can't force PHP to save details about uploded files in $_SESSION (http://www.php.net/manual/en/session.upload-progress.php). All I can get is empty session.

我的代码最简单的例子:

The most simple example of my code:

index.php

<?php 
    session_start();
    $_SESSION['test'] = 'TEST';
?>

<form action="index.php" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="123" />
    <input type="file" name="file1" />
    <input type="file" name="file2" />
    <input type="submit" />
</form>

<?php 
    print_r($_SESSION); 
?>

结果 - 点击提交后;)

Array ( [test] => TEST ) // nothing more...

php -i |grep upload_progress

session.upload_progress.cleanup => Off => Off
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress_ => upload_progress_

php -i |grep 大小

post_max_size => 2G => 2G
realpath_cache_size => 16K => 16K
upload_max_filesize => 2G => 2G
Command buffer size => 4096
Read buffer size => 32768

<小时>

  • 上传文件的文件大小(本地主机):2 x 1.5GB
  • 执行时间:8 秒
  • 我使用 Gentoo linux 和 php 5.5.12,Apache 2 编译没有快速 CGI 支持.
  • 参考书目:

    https://stackoverflow.com/a/21851657/1125465 - 就我而言这些在我的配置中没问题.

    https://stackoverflow.com/a/21851657/1125465 - as far as I'm concerned each of these are OK in my configuration.

    https://stackoverflow.com/a/13186859/1125465 - 尝试了所有脚本和所有版本.SESSION superglobal 为空.

    https://stackoverflow.com/a/13186859/1125465 - tried all the scripts, and all the versions. SESSION superglobal is empty for each one.

    https://stackoverflow.com/a/11485170/1125465 - 当我评论这个答案时......是不是答案.

    https://stackoverflow.com/a/11485170/1125465 - As I commented this answer... Is not an answer.

    请帮忙!我开始失去理智.最好的问候.

    Please, help! I'm starting to loose my mind. Best regards.

    更新 phpinfo() 结果截图:

    UPDATE phpinfo() result screenshot:

    值得注意的是,文件正在上传到 tmp 目录,没有任何问题.

    It is worth notice that files are being uploaded to tmp directory, without any troubles.

    推荐答案

    我遇到了完全相同的问题.解决方案是简单地将处理程序从 FastCGI 替换为 PHP-FPM.也适用于 Mod PHP,但即使使用新的 PHP,它也不适用于 FastCGI.

    I had exactly the same issue. Solution was to simply replace the handler from FastCGI to PHP-FPM. Also works on Mod PHP but it doesn't work on FastCGI even with the new PHP.

    这篇关于PHP Session 上传进度 EMPTY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆