eAccelerator error and cache type setup

eAccelerator error and cache type setup

by Veronica Bendersky -
Number of replies: 18

Hi all!

I have a Moodle install 1.9.7+ version. The server has PHP 5.2.13 and eAccelerator 0.9.6 . The server uses cPanel / WHM.

We tried to set cache type to 'eaccelerator' and got the following error:

"eaccelerator is set to true but the required functions are not available. You need to have either eaccelerator or turckmmcache extensions installed, compiled with the shmem keys option enabled."

I've found out that the functions Moodle is trying to use (eaccelerator_get and eaccelerator_put) have been removed from eAccelerator at version 0.9.6 .

I have been reading lots of forum posts and I am not sure what is the best way to go regarding the cache settings. If anyone could point me in the right direction I would really appreciate it.

I see one possibility could be to leave eAccelerator enabled and set cache type to none. Would then eAccelerator help in any way? Is this a valid alternative?

Another possibility I see is to disable eAccelerator, and install APC from Pecl instead. What are the right settings for cache type and rcache if I use APC? Are there known issues?

Thanks in advance for any help!

Regards,

Veronica

 

Average of ratings: -
In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -

Hey Veronica,

Are you certain of this?  The reason I ask is that we are running Moodle 1.93+ and eAccelerator 0.9.6 with PHP 5.2.9 without issue.  Here is the eaccelerator info. Perhaps the Moodle code change was after our 1.93?

eAccelerator

eAccelerator support enabled
Version 0.9.6
Caching Enabled true
Optimizer Enabled true
Check mtime Enabled true
Memory Size 16,777,176 Bytes
Memory Available 108 Bytes
Memory Allocated 16,777,068 Bytes
Cached Scripts 252
Removed Scripts 0

Directive Local Value Master Value
eaccelerator.allowed_admin_path no value no value
eaccelerator.cache_dir /tmp/eaccelerator /tmp/eaccelerator
eaccelerator.check_mtime 1 1
eaccelerator.debug 0 0
eaccelerator.enable 1 1
eaccelerator.filter no value no value
eaccelerator.log_file no value no value
eaccelerator.optimizer 1 1
eaccelerator.shm_max 0 0
eaccelerator.shm_only 0 0
eaccelerator.shm_prune_period 0 0
eaccelerator.shm_size 16 16
eaccelerator.shm_ttl 0 0

In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Veronica Bendersky -

Hi Ken,

We have the same eAccelerator version and configuration that you have.

What cache type and rcache did you set for Moodle? The error appears when we have cache type set to eaccelerator.

Thanks for your reply.

Regards,

Veronica

In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -
Here are the settings in admin:
Moodle 1.9.3+ (Build: 20081210)
 
 eaccel.jpg
Again - maybe this works on our 1.93+, but not on 1.97+ ?
In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -

For this:

"eaccelerator is set to true but the required functions are not available. You need to have either eaccelerator or turckmmcache extensions installed, compiled with the shmem keys option enabled."

Are you certion that you have a compiled php version with eaccelerator enabled? What do your php settings say under admin>>server>>php info

Ken

In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Veronica Bendersky -

Hi Ken,

Thanks for responding.

Php is compiled with eAccelerator enabled, I see it in php info.

This is what it shows:

eAccelerator

eAccelerator support enabled
Version 0.9.6
Caching Enabled true
Optimizer Enabled true
Check mtime Enabled true
Memory Size 16,777,176 Bytes
Memory Available 740 Bytes
Memory Allocated 16,776,436 Bytes
Cached Scripts 190
Removed Scripts 0

Directive Local Value Master Value
eaccelerator.allowed_admin_path no value no value
eaccelerator.cache_dir /tmp/eaccelerator /tmp/eaccelerator
eaccelerator.check_mtime 1 1
eaccelerator.debug 0 0
eaccelerator.enable 1 1
eaccelerator.filter no value no value
eaccelerator.log_file no value no value
eaccelerator.optimizer 1 1
eaccelerator.shm_max 0 0
eaccelerator.shm_only 0 0
eaccelerator.shm_prune_period 0 0

The problem appears when Moodle tries to use the eaccelerator class defined at lib/eaccelerator.class.php. Right at the beginning of the class, it tries to use a function that no longer exists:

class eaccelerator {

    function eaccelerator() {
        global $CFG;
        if ( function_exists('eaccelerator_get')) {
            $this->mode = 'eaccelerator';
        } elseif (function_exists('mmcache_get')) {
            $this->mode = 'mmcache';
        } else {
            debugging("\$CFG->eaccelerator is set to true but the required functions are not available. You need to have either eaccelerator or turckmmcache extensions installed, compiled with the shmem keys option enabled.");
        }

I wrote a small script after I read another forum post to list all eaccelerator functions currently defined:

print_r(get_extension_funcs( 'eaccelerator' ));

And this is the output:

Array
(
    [0] => eaccelerator_caching
    [1] => eaccelerator_clear
    [2] => eaccelerator_clean
    [3] => eaccelerator_info
    [4] => eaccelerator_purge
    [5] => eaccelerator_cached_scripts
    [6] => eaccelerator_removed_scripts
    [7] => eaccelerator_check_mtime
    [8] => eaccelerator_optimizer
)

eaccelerator_get is not listed in there, neither are other functions used in this class like eaccelerator_unlock or eaccelerator_put.

Regards,

Veronica

In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by HJWUCGA INC. -
If this still does not work, you could always go back to a previous release ...

http://eaccelerator.net/wiki/Release-0.9.5.3

how did you install / compile eAccelerator?

You should see it in your PHP info.




In reply to HJWUCGA INC.

Re: eAccelerator error and cache type setup

by Veronica Bendersky -

I installed and compiled using WHM easyapache.

In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -
Hmm....so how then is eaccelerator caching scripts for you if Moodle isn't talking to it? You show 190 cached.
In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -

I get this from your script:

Array ( [0] => eaccelerator_caching [1] => eaccelerator_clear [2] => eaccelerator_clean [3] => eaccelerator_info [4] => eaccelerator_purge [5] => eaccelerator_cached_scripts [6] => eaccelerator_removed_scripts [7] => eaccelerator_check_mtime [8] => eaccelerator_optimizer )

so the same as you.

Ken

In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Veronica Bendersky -

Thank you very much for verifying this Ken. I was wondering which functions would be enabled at your install.

In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -

see: http://eaccelerator.net/wiki/TroubleShooting

I assume you are having files cached - based on the above info you posted, so other than the Moodle debug error, how do you know it is not working?  

In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Ken Gibson -
In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Veronica Bendersky -

Yes I did, that's how I learnt that those functions no longer exist at 0.9.6 . But then I am puzzled because you are actually using 0.9.6 version and it is working for you.

In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -

Upon further review (turned on debugging), I am getting the same error thrown at me that you see (no eaccelerator _get running).

Having said that - we are actively caching scripts (so something in moodle is firing), but we may not be accessing the cache.  I did see a signficant speed increase since we added this (but maybe that was related to something else in the recompile).

Ken        

  

In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Ken Gibson -

Ok - did a little more digging: http://moodle.org/mod/forum/discuss.php?d=90778

Turn off "cachetype" (set it to internal) in the Moodle admin settings. You don't need it to take advantage of eaccelerator, and as the info next to that setting says, it can make your site much slower.

Most of what eaccelerator does is works with PHP to cache processed scripts, and Moodle has no say in that.

The short answer - Moodle thinks our eaccelerator installs are broken, but it eaccelerator is working outside of Moodle to make PHP faster, so disable any eaccelerator settings within Moodle. This is why I saw the performance kick, despite Moodle debugging telling me it wasn't functioning.

In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Veronica Bendersky -

Thank you Ken. We're going to try this setup and see how performance goes.

In reply to Veronica Bendersky

Re: eAccelerator error and cache type setup

by Ken Gibson -

Also - see if you can up the memory to ~40MB, read that was min for Moodle scripts.  Upped mine this afternoon and cached scripts have tripled.

eAccelerator

eAccelerator support enabled
Version 0.9.6
Caching Enabled true
Optimizer Enabled true
Check mtime Enabled true
Memory Size 33,554,392 Bytes
Memory Available 5,941,268 Bytes
Memory Allocated 27,613,124 Bytes
Cached Scripts 362
Removed Scripts 0

Directive Local Value Master Value
eaccelerator.allowed_admin_path no value no value
eaccelerator.cache_dir /tmp/eaccelerator /tmp/eaccelerator
eaccelerator.check_mtime 1 1
eaccelerator.debug 0 0
eaccelerator.enable 1 1
eaccelerator.filter no value no value
eaccelerator.log_file no value no value
eaccelerator.optimizer 1 1
eaccelerator.shm_max 0 0
eaccelerator.shm_only 0 0
eaccelerator.shm_prune_period 0 0
eaccelerator.shm_size 32 32
eaccelerator.shm_ttl 0 0
In reply to Ken Gibson

Re: eAccelerator error and cache type setup

by Veronica Bendersky -

eAccelerator in fact seems to be working. I see cached scripts at /tmp/eaccelerator. It just looks like moodle is trying to use some functions from the eaccelerator api which are no longer there, and thus it throws the error. I am checking with the person who saw the error to find out at which page the error appeared, or if it showed at different pages.