Search code examples
phpsessionuploadprogress

PHP Session upload progress EMPTY


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

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

result - after clicking submit ;)

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 size

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

  • The file size of file beeing uploaded (local host): 2 x 1.5GB
  • Time of execution: 8 seconds
  • I'm using Gentoo linux with php 5.5.12, Apache 2 compiled without Fast CGI support.

Bibliography:

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 - tried all the scripts, and all the versions. SESSION superglobal is empty for each one.

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.


UPDATE phpinfo() result screenshot:

phpinfo() screenshot

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


Solution

  • 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.