|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2007-10-23 14:44 UTC] stefan dot rutenkolk at freenet dot de
 Description:
------------
I developed a progress bar and it works fine on my windows XP system:
  Apache/2.0.55
  PHP 5.2.3
  APC 3.0.15-dev, 
but on the server 
  openSUSE 10.2 (X86-64)
  kernel-version: 2.6.18.8-0.5-default
  Apache/2.2.6 (Linux/SUSE)
  PHP 5.2.0
  APC 3.0.15
it gets false always.
The apc.rfc1867 is true and all other settings having the same values as on my windows system.
Reproduce code:
---------------
<?php
if(isset($_GET['progress_key'])) {
  $status = apc_fetch('upload_'.$_GET['progress_key']);
  echo json_encode($status);
  exit;
}
?>
Expected result:
----------------
{"total":xxxxx,"current":yyyyy,
"filename":"filename.ext",
"name":"thefile",
"done":0,
"start_time":zzzzz}
Actual result:
--------------
false
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 21:00:02 2025 UTC | 
hey, here is my JavascriptSnippet (i use the twobird lib): first: function callUpload(_progress_key) { progress_key = _progress_key; //alert('progressKey: '+progress_key); tb.request.add( ajaxCallback, 'GET', '/src/common/progress.php', 'progress_key='+_progress_key, false); } callback: function ajaxCallback( pXml, pText ) { if (pText!="") { var resp = eval('(' + pText + ')'); var rDone = resp['done']; //alert('pText: '+pText+ ' pXml: '+pXml+' resp: '+rDone); var txt = ''; if (!resp['done']) { if(resp['total']) { pct = parseInt(100*(resp['current']/resp['total'])); txt = pct+'% '+resp['current']+" von "+resp['total']+" bytes"; if (pct==100) { txt = txt+ " - bitte warten, Datei wird gepr?ft -"; } } setTimeout("checkUpload()",500); } else { txt=resp['total']+" bytes uploaded!"; g_uploadCanceled='true'; } document.orderForm.uplOutput.value=''; document.orderForm.uplOutput.value=txt; if (pct!='') { document.getElementById("ladebalken").style.width = pct; document.getElementById("ladebalken").style.backgroundColor = '#000000'; } } else { setTimeout("checkUpload()",500); } } +++++++++++++++++ APC Support enabled Version 3.0.19 MMAP Support Enabled MMAP File Mask no value Locking type pthread mutex Locks Revision $Revision: 3.154.2.5 $ Build Date Oct 8 2008 20:34:02ok, rfc1867 must be on here the other settings: Directive Local Value Master Value apc.cache_by_default On On apc.coredump_unmap Off Off apc.enable_cli Off Off apc.enabled On On apc.file_update_protection 2 2 apc.filters no value no value apc.gc_ttl 3600 3600 apc.include_once_override Off Off apc.max_file_size 1M 1M apc.mmap_file_mask no value no value apc.num_files_hint 1000 1000 apc.report_autofilter Off Off apc.rfc1867 On On apc.rfc1867_freq 0 0 apc.rfc1867_name APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS apc.rfc1867_prefix upload_ upload_ apc.shm_segments 1 1 apc.shm_size 30 30 apc.slam_defense 0 0 apc.stat On On apc.stat_ctime Off Off apc.ttl 0 0 apc.user_entries_hint 4096 4096 apc.user_ttl 0 0 apc.write_lock On On +++++++++++++++++++++++++++++++++++++++++++ HTML: <form enctype="multipart/form-data" name="uploadForm" method="post" action="./Contr.php?PHPSESSID=<smarty:php/>echo session_id();<smarty:/php/>"> <input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key" value="<smarty:php/>echo time();<smarty:/php/>"/> <input name="thefile" type="file"> ++++++++++++++++++++++++++++++++++++++++ progress.php: <?php /* getprogress.php */ if(isset($_GET['progress_key'])) { $status = apc_fetch('upload_'.$_GET['progress_key']); echo json_encode($status); exit; } ?> +++++++++++++++++++++++++++++++++++++++++ sorry, cannot try any other version, because i am the programmer not the sysAdmin. Good luck.I've developed a simple progress bar and it kept working so far. But recently while I was trying to upload a comparatively larger file (say 25MB) , apc_fetch started returning false value. Small files (say 4/5 MB) still works good. I've increased apc.max_file_size to 1G (my upload_max_filesize is also equal to 1G) and still the problem persists. Here is my apc settings: [apc] extension=apc.so apc.enabled=1 apc.shm_segments=1 apc.shm_size=128 apc.ttl=7200 apc.user_ttl=7200 apc.num_files_hint=1024 apc.mmap_file_mask=/tmp/apc.XXXXXX apc.enable_cli=1 apc.rfc1867 = On apc.max_file_size = 1G Other system config: #uname -a Linux www.xxxxyyyzz.com 2.6.18-128.4.1.el5 #1 SMP Tue Aug 4 20:23:34 EDT 2009 i686 athlon i386 GNU/Linux CentOS release 5.3 (Final) Here is the progress bar script: <?php header('Expires: Tue, 08 Oct 1991 00:00:00 GMT'); header('Cache-Control: no-cache, must-revalidate'); if(isset($_GET['uid'])){ $status = apc_fetch('upload_' . $_GET['uid']); echo round($status['current']/$status['total']*100); } ?> Any idea? Thanks