Topic: php-pecl-apc 3.1.3p1-1.el5.remi APC_UPLOAD_PROGRESS error

Hi Remi,

Just finished upgrading my production server to php 5.3 and it went smooth for the most part, except it broke some of my pecl packages.

one important one is uploadprogress-1.0.1

the other one was apc.

i knew apc supported upload progress function so, I found you had it, and upgraded. apc work great, but the upload_progress functionality seems to be missing some data. Do you have any idea what could be wrong?

My Output of apc_fetch("upload_$_POST[APC_UPLOAD_PROGRESS]");

[13-Jan-2010 20:54:45] Array
(
    [total] => 1040345
    [current] => 1008763
    [filename] => M3_1680x1280_4.jpg
    [name] => photo
    [done] => 0
    [start_time] => 1263444874.1257
)

When the documentation says it should be:

Array
(
    [total] => 1142543
    [current] => 1142543
    [rate] => 1828068.8
    [filename] => test
    [name] => file
    [temp_filename] => /tmp/php8F
    [cancel_upload] => 0
    [done] => 1
)

I seem to be missing rate...but i have start_time...
Am I supposed to calculate it myself?

Any suggestions on fixing pecl uploadprogress or apc is greatly appreciated!

(PS: the pecl error is when i restart apache it says it cant load the module because of mismatched api version, so i downloaded and recompiled [phpize reports proper api version] and still nothing)

Re: php-pecl-apc 3.1.3p1-1.el5.remi APC_UPLOAD_PROGRESS error

I wrote a workaround but still unsure of what is wrong with PECL.

here is the workaround

$info['rate'] = $info['current'] / (time() - $info['start_time']);
$info['est_sec'] = round(($info['total'] - $info['current']) / $info['rate']);

Re: php-pecl-apc 3.1.3p1-1.el5.remi APC_UPLOAD_PROGRESS error

Each PECL extension requires a specific PHP API/ABI, so must be build against one specific version (5.1 or 5.2 or 5.3).

A lot of php-pecl-* package are available in remi repo, but not (yet) uploadprogress (not available on fedora, so not backported to remi, and not created as an original remi package because I don't use it)

Your workaround seems fine, except you should probably use microtime(true) instead of time()

++

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php-pecl-apc 3.1.3p1-1.el5.remi APC_UPLOAD_PROGRESS error

Makes a lot of sense.

I think I'm solid with APC...and microtime(), yeah a little tired...

Thanks for all your hard work on php and apc!!!