php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57888 APC_FETCH returns false (Suhosin + apc.rfc1867)
Submitted: 2007-10-23 14:44 UTC Modified: 2010-09-09 10:12 UTC
Votes:5
Avg. Score:4.2 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:1 (20.0%)
From: stefan dot rutenkolk at freenet dot de Assigned:
Status: No Feedback Package: APC (PECL)
PHP Version: 5.2.0 OS: openSUSE 10.2 (X86-64)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-24 05:59 UTC] stefan dot rutenkolk at freenet dot de
I updated the PHP-Version to 5.2.4,
but the problem exists further.
 [2007-10-28 11:14 UTC] gopalv82 at yahoo dot com
Are you using FastCGI?
 [2007-10-29 04:51 UTC] stefan dot rutenkolk at freenet dot de
No, I don't use FastCGI.
 [2007-11-03 22:43 UTC] pedrofuentes at gmail dot com
i have the same problem on a debian etch, php 5.2.0, apache 2.0, APC 3.0.15

i upload a file, it tells false, but when the upload finish i can view de data, i search for the apc.xxxxxx in the tmp directory but nothing is created, i chech with the apc.php file and it seems that all is ok.
 [2007-11-05 14:16 UTC] frank dot burian at gmail dot com
Hey,

i have the same problem. i use openSUSE 10.2 and php 5.2.4!
i have installed the apc-extension via a rpm-file, and the apc extension seems to work. after this, i test upload with progressbar and it doesn't work. the return is also false!

have someone a solution?

thx
 [2007-11-05 14:44 UTC] pedrofuentes at gmail dot com
did you see if the apc.xxxxxx file in tmp directory exists during the upload ?
 [2007-11-06 02:17 UTC] frank dot burian at gmail dot com
Hey. I didn't see the apc.xxxxxx file during the upload! Why is this so? Have someone a idea to solve this problem? thx
 [2007-11-07 07:49 UTC] stefan dot rutenkolk at freenet dot de
Frank has found a workaround.

The problem is solved, if you deaktivate the 'suhosin-patch'!

Comment the extension=suhosin.so in the /etc/php5/conf.d/suhosin.ini File out or move the suhosin.ini file to a directory which is not added.

Thanks Frank.
 [2007-11-07 10:04 UTC] gopalv82 at yahoo dot com
Closed as Bogus
 [2007-12-06 04:14 UTC] gianiaz at gianiaz dot net
i have the same problem. i use openSUSE 10.2 and php 5.2.4!

I don't have the subhosin extension, but I receive always false.

On another server(ubuntu php 5.3.2) the same piece of code works. 

php.ini settings are the same...
 [2009-03-02 08:55 UTC] wamccarthy at bedmas dot com
I have Ubuntu 8.4 installed. I installed the apc extension and everything seems to work perfectly but apc_fetch returns false. I see that "gianiaz at gianiaz dot net" has it working with Ubuntu. Which version of Ubuntu are you using? I hope my problem is something simple as I am spending way to much time working on this one.

Thanks,
Bill
 [2009-03-02 14:31 UTC] shire@php.net
Can you re-post your reproduction script including your HTML post form you're using.  Can you send us your 'php -m' output as well as which version of APC you're using?  I'd like you to try the latest APC CVS version as well as there's a fix for RFC1867 that could cause unexpected behavior on different platforms.
 [2009-03-03 03:26 UTC] stefan dot rutenkolk at freenet dot de
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:02
 [2009-03-03 15:00 UTC] shire@php.net
Was hoping for more HTML and PHP, less javascript ;-).  Bascially I wanted to know what your HTML form elements where that's doing the original upload.  Can you paste your APC rfc1867 settings as well.

Have you had a chance to try the CVS version of APC?
 [2009-03-04 02:38 UTC] stefan dot rutenkolk at freenet dot de
ok,

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.
 [2009-03-04 17:11 UTC] shire@php.net
There is a file called apc.php included in the source code that lets your browse the APC cache.  Can you use this to browse your user cache and validate that you don't have any entries with the rfc1867 prefix you've used?

If this turns out to be a problem with APC then we're likely limited with what we can do to fix your bug as I won't be able to get any validation that it's fixed if you can't upgrade and I can't currently reproduce, although it seems likely that this may be a problem with the code, I would try simplifying your test case to a simple reproduction with a constant key suffix etc.
 [2009-04-05 11:21 UTC] dannt at toasterbridge dot com
Hi guys.

It seems I have the same problem here with Debian-lenny:
I installed apache2.2.11 + php 5.2.9 + latest stable APC.
Then copied working code from my freeBSD server to work on it at my local machine: it doesn't work.

The same code is works well at freeBSD machine but doesn't work on my one. I spotted apc_fetch does return false instead of array.

Any ideas? thanks
 [2009-04-05 11:27 UTC] dannt at toasterbridge dot com
Guys I'm sorry for disturbing you: I have fixed this.

I'd like to post the solution for further problem requests. Not sure what exactly caused the problem but I have changed this one:

--------------------------------------------
apc.rfc1867 = on

[APC]
;specifies the size for each shared memory segment 8MB to start
apc.shm_size=8
;max amount of memory a script can occupy
apc.max_file_size=1M
apc.ttl=0
apc.gc_ttl=3600
; means we are always atomically editing the files
apc.file_update_protection=0
apc.enabled=1
apc.enable_cli=0
apc.cache_by_default=1
apc.include_once_override=0
apc.localcache=0
apc.localcache.size=512
apc.num_files_hint=1000
apc.report_autofilter=0
apc.rfc1867=0
apc.slam_defense=0
apc.stat=1
apc.stat_ctime=0
apc.ttl=7200
apc.user_entries_hint=4096
apc.user_ttl=7200
apc.write_lock=1
--------------------------------------------

with the following:

--------------------------------------------
[APC]
apc.rfc1867 = on
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
--------------------------------------------

And now it works brilliant!
I hope this will help.

Cheers, Danny.
 [2009-04-05 22:57 UTC] shire@php.net
dannt: Just wanted to confirm if you could verify if this a problem on the latest CVS (not latest stable).  You have posted a number of INI changes, is there one specific INI configuration that you changed that changed this behavior?
 [2009-05-05 14:48 UTC] shire@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2009-05-06 04:01 UTC] toms at linuxos dot sk
Hi,

I'm experiencing the same problem as Dannt. I'm using debian-lenny amd64 + apache + php5/fastcgi and apc_fetch keeps returning false. I've tried using both apc versions - from debian repositary (package php-apc) and also stable version from pecl. Online demo on debian server can be found at http://dev.srnka.info/TEMP/file-upload/ . The same script working on CentOS box with apache + mod_php can be found at http://toms.linuxos.sk/gsoc09/file-upload/ .

You can download file-upload script from: http://dev.srnka.info/TEMP/file-upload/upload-progress-bar.zip

My APC configuration is the same on both servers:
extension=apc.so
     apc.enabled=1
     apc.shm_segments=1
     apc.shm_size=256
     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
 [2009-10-01 10:52 UTC] boudoux at nelis dot fr
Same problem here.

Using debian lenny amd64 and php5.3.0.
Always got a false response from apc_fetch.

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.enable_cli=1

;activation pour le progress meter
  apc.rfc1867=On
  apc.rfc1867_prefix=upload_
  apc.rfc1867_name=APC_UPLOAD_PROGRESS
  apc.rfc1867_freq=300k
 [2009-10-30 10:59 UTC] scriptlancer1975 at gmail dot com
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
 [2009-11-19 18:46 UTC] anair at land dot ru
Then i run two browsers whith script-uploader , parametr 'current' is wrong value. Why ? can we help my?
 [2009-11-29 10:11 UTC] nobody at yopmail dot com
Here are some informations about why APC/RFC1867 may not be working well:
http://mylittlereminder.wordpress.com/2009/11/13/webdevphp-settle-an-upload-form-with-apcrfc1867/
 [2010-03-16 21:12 UTC] pauljm at gmail dot com
If APC isn't creating a cache entry for your upload, make sure 
your form tag has method="post" and enctype="multipart/form-
data"... Things finally started working for me when I added 
the enctype attribute.
 [2010-09-09 10:04 UTC] cyril dot roume-prestataire at gmail dot com
Is there any solution to solve this issue ?
OS SUSE SLES 10 SP2
PHP 5.2.5
APC 3.0.19
I've got the same behavior previously reported :
if activate Suhosin apc_fetch return null,
else  apc_fetch work fine

I tried plenty of configuration for php, apc and Suhosin 
posted on forums but i didn't find any one working.

Does any one have an idea (which is not unactivate Suhosin 
...) ?
 [2010-09-09 10:12 UTC] kalle@php.net
> cyril dot roume-prestataire at gmail dot com

Thats an old and outdated version of APC, upgrade first, same for PHP in your case.

Also, we don't support third party patched installations, if Suhosin causes it then report it to them the authors
 [2010-10-18 16:42 UTC] throwaway at indietorrent dot org
Is this bug related to (or a duplicate of) this bug? I came looking here and then found the solution at:

http://pecl.php.net/bugs/bug.php?id=13583

Within the HTML form from which the data is POST-ed

<input type="hidden" name="APC_UPLOAD_PROGRESS" value="someUniqueId">

must come before

<input type="file" name="fileName" />
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 21:01:29 2024 UTC