I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Frankie Kam -
Number of replies: 12
Picture of Plugin developers

Hi y'all

I've installed eaccelerator with my Linux VPS by referring to
http://www.php.ph/2007/12/21/centos-5-eaccelerator-installation/

However why is the value for "cached scripts" always 1? Dooes this mean that my site (http://scm.moodleace.com) is not caching the peages?

Check out this window of information on my Linux VPS' phpinfo():

Can anyone help me out here? I need to get my php files cached. At the moment, I suspect that although caching is enabled, caching is still not wotking. By now it should have cached MORE than I script.

Frankie Kam
http://scm.moodleace.com

Average of ratings: -
In reply to Frankie Kam

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Dale Davies -
Picture of Particularly helpful Moodlers Picture of Plugin developers

I think the problem is that versions of eaccelerator after 0.9.5.3 dropped support for the PHP commands used by Moodle (and other PHP software like Wordpress etc).  Using version 0.9.5.3 my system reports 232 cached scripts.

See the following release page for the eaccelerator 0.9.6 branch which states the "user cache functions have been removed"...

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

In reply to Dale Davies

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Frankie Kam -
Picture of Plugin developers

Aha! The plot thickens! Thanks Dale for the fact and insight. That would saved me countless hours of trying to get it to work.... now to download the lower version. I'll keep you updated. wink

In reply to Dale Davies

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Frankie Kam -
Picture of Plugin developers

Dale - it works now. Thanks.

The steps I used:

Through SSH.

yum install php-devel

yum groupinstall 'Development Tools'

Change directory.

cd /tmp

ls -d */

Get the file.

wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xvfj eaccelerator-0.9.5.3.tar.bz2

Change directory.

cd eaccelerator-0.9.5.2

Phpize.

phpize

./configure

Install it.

make

make install

Create the file /etc/php.d/eaccelerator.ini

vi /etc/php.d/eaccelerator.ini

Enter.

extension="eaccelerator.so"
eaccelerator.shm_size="0"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

Create /var/cache/eaccelerator ditrectory

mkdir -p /var/cache/eaccelerator

Change permission.

chmod 0777 /var/cache/eaccelerator

Restart Apache.

/etc/init.d/httpd restart

In reply to Dale Davies

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Frankie Kam -
Picture of Plugin developers

Dale, my PHP info shows cached scripts as 356. If I never added any other courses or php pages to my Moodle site, would that figure remain as 356? Or is it expected to increase as users login and use my Moodle site?

Frankie Kam

In reply to Frankie Kam

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Dale Davies -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Great! Im glad it worked for you, as far as I can remember I was getting some errors in the error.log too.  I have a Wordpress site on the same server which uses the W3 Total Cache plugin, but for some reason it just wouldnt work with eAccelerator. I found the solution in a comment at the Wordpress support forums and after a little investigation discovered this was also affecting Moodle.

With regards to the cached scripts figure, I have absolutely no idea.  I presume as you use the site that figure would go up, although I cant explain why my cached scripts count is lower.

In reply to Dale Davies

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Frankie Kam -
Picture of Plugin developers

Hi Dale.

I've finally done it. I've found the Holy Grail of Php Servr optimisation. I have reached the end of my Quest, Gandlaf.

in my last post, I saw that eAccelerator had cached 365 pages. However, when I ran the control.php file, I didn't see pages listed as being cached. Hours later, I checked with my Web Host and they replied that eAccelerator doesn't work when Php is being run as cgi. So I surfed around and discovered that

"eAccelerator only works with mod_php or php in fastcgi mode. It can't be used in cgi or cli because eAccelerator needs to set up shared memory, and this can only be done when all php instances that need to access it are forks of the first process".

http://moodle.org/mod/forum/discuss.php?d=165904

I then proceeded to go to my Plesk Control Panel and under "Website and Domains" tab and "Hosting Settings for domainname.com", I found what I was looking for. The option to change Php to run under fast-cgi. See attached gif:

And now I am as happy as a clam.  See my additional screenshots and explanation on speeding up my Moodle site with eAccelerator at: http://moodle.org/mod/forum/discuss.php?d=165904

Frankie Kam
One happy clam

Average of ratings: Useful (1)
In reply to Frankie Kam

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by jonnym m -

Hi

I'm having abit of a headache setting this up.  I followed the recomendations by Frankie Kam found here:

http://moodurian.blogspot.co.uk/2011/07/how-i-speeded-up-my-moodle-site.html

When I look at my PHPinfo.php I see the cached scripts are bouncing not staying in the cache. 

Ive set it up on my Dev server, when I use moodle I see the cached scripts increase to over 100, then collapse back to 45.

Any clues why?

thanks

Jonnym

Edit: they are now back to 1

In reply to jonnym m

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by jonnym m -
Ahh OK so i need to roll back to an earlier version of eaccelerator. I'm not sure how to do that as I installed it under easy apache, I will have to go and do some more research!
In reply to jonnym m

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by jonnym m -
I can't find http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2 as that link is dead. On https://github.com/eaccelerator/eaccelerator/downloads there is eaccelerator-0.9.5.2.tar.bz2 would this be a viable option? thanks Jonnym
In reply to jonnym m

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
PHP accelerators seem to be moving targets. You'll find a couple of choices here: "Update on PHP-accelerators" https://moodle.org/mod/forum/discuss.php?d=168965, but possibly outdated.

I found installing APC is easy, on both Debian and CentOS.

P.S. Jonny, I noticed that you've submitted the three posts above within 3 minutes. You know that a post remain editable for 30 min. after submission?
In reply to Visvanath Ratnaweera

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by jonnym m -
Yes I will look into APC. Ironically I had removed APC in favour of Eaccelerator. I will post my thoughts about Eaccelerator in a separate post as it hasn't worked out for me. thanks for the advise Jonnym P.S. only two posts in 3 mins, the second was from my phone which seems to object to editing a post.
In reply to Frankie Kam

Re: I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?

by jason everling -
Actually you had 0.9.6.1 working properly but under you config you had only 2mb allocated in your config which is enough to probably cache one script, there was no need to go down versions. All you had to do is change the "Memory Allocated" in your config from 2 to 32 or 64 and it would have cahced more. I have ours set 32MB 0.9.6.1 and it has about 500 scripts cached, Surprised no one in here caught that. Jason