Forum Moderators: coopster

Message Too Old, No Replies

APC functions

Call to undefined function.

         

MattyMoose

12:01 am on May 25, 2005 (gmt 0)

10+ Year Member



Hi all,

FreeBSD 5.4, ports up to date.

I've installed pecl-APC [pecl.php.net ], to use apc_store and apc_fetch. phpinfo(); shows:


APC Support enabled
Version 2.0.3
MMAP Support Enabled
MMAP File Mask no value
Revision $Revision: 3.27 $
Build Date May 24 2005 16:16:22
DirectiveLocal ValueMaster Value
apc.enabled11
apc.filtersno valueno value
apc.gc_ttl36003600
apc.mmap_file_maskno valueno value
apc.num_files_hint10001000
apc.optimization00
apc.shm_segments11
apc.shm_size3030

Even everything seems to have installed and been enabled, I still can't use the apc_store() function with this code (taken from Rasmus' demo):


<?php
$a = array(1,2,3);
apc_store('my_array', $a, 5);
$a = 0;
echo "<pre>"; var_dump($a); echo "</pre>";
$b = apc_fetch('my_array');
echo "<pre>"; var_dump($b); echo "</pre>";
?>

returns with:


Fatal error: Call to undefined function: apc_store() in /usr/local/www/data-dist/shmop/apc.php on line 3

So I'm wondering if anyone has had any luck in setting this up and using it. I can't find documentation anywhere, and it's not part of the standard php core, so there's no references to it in php.net

Any hints would much appreciated!

MM

jatar_k

6:59 pm on May 25, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



since Mr. Moose and I are working on this together I can only assume no else has ventured into this realm much ;)

ergophobe

9:56 pm on May 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sorry, but you're right. I don't want to divert things too much, but have you seen any APC benchmarking compared to other solutions or even just to no caching?

Or just from your experience, should more of us be interested in this?

jatar_k

10:14 pm on May 25, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> should more of us be interested in this

good point, not sure really we are looking at ways of using shared memory to store various things

we are loading some things to be available through $_SERVER and then we have a ton of constants we want to load and this was a way we had seen to do it, we also are just playing around to a certain extent.

We don't know if this is the answer yet but we have a few dev servers so if we mess one up, who really cares. ;)

MattyMoose

11:38 pm on May 25, 2005 (gmt 0)

10+ Year Member



It primarily struck us to use this when Rasmus was giving a speech, speaking about different ways of doing things... As a benchmark, he was defining thousands of contants, and spitting them all out. By using the APC code, he was able to increase the efficiency of it immensely, with using mmap when starting Apache. (this is all IIRC) ;)

Matt

jatar_k

5:19 am on May 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I guess we will have to post it when we find an answer ourselves ;)

coopster

11:08 pm on May 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I've no experience with it either, but that module is over a year old and the install states that it is stable up through PHP 4.3. Have you tried their mailing list? [pecl.php.net...]

ergophobe

12:12 am on May 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you looked at the get_defined_functions() output?

It looks like most of the APC funcs have "apc" somewhere in the name, so you could grep for them and get a list that way perhaps.

ergophobe

12:17 am on May 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



PS, have your read this:

[apc.communityconnect.com...]

jatar_k

2:29 am on May 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



now we're talkin, alright we will look at that tomorrow

actually, we may have gone a completely different way on this, we may use Zend Platform to do caching of the files we are thinking of. We already have the apache $_SERVER stuff working for what we need it to.