nixCraft Poll

Topics

Lighttpd web server and php eAccelerator cache problem

Posted by Vivek Gite [Last updated: August 29, 2006]

eAccelerator is a fork of MMCache which provide an opcode cache and encode i.e. it increases performance of php based application by providing web (content) caching for dynamic apps.

Recently one of Linux box, which runs Lighttpd, started to sever php pages very slowly. First, I thought server might be severing large amount of request but netstat just return over 600 connection:
$ netstat -vtn | wc -l

Output:

649

System load was under control:
$ uptime
Output:

12:09:32 up 87 days, 11:58,  1 user,  load average: 1.08, 1.19, 1.06

No zombie process were found. Next I had gone through server logs and error logs and found nothing special. I did restarted both Lightttpd and MySQL servers. Memory usage was under control. HTML pages was loading fine, it was php application. All php based application was taking time to load (but no connection time out error). It was clear something was wrong with PHP.

So I started to investigate all php related installed extension. I found eAccelerator installed on system. I went to /chroot/var/cache/php-eaccelerator and I found over 5000+ files.

I had just deleted all cached files and voila! My problem was solved php started to work normally:
# rm -f *
# /etc/init.d/lighttpd restart

I guess now I need to write a script that will delete cahce on regular basis.

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Anish Says:

    Hi Need a script for that.. can you please provide one…

  2. nixcraft Says:

    Script is quite easy:
    #!/bin/sh
    CROOT=/var/cache/php-eaccelerator
    RSTART="/etc/init.d/lighttpd restart"
    cd $CROOT
    rm -f *
    $RSTART

  3. Steve Says:

    There is an option in EA which allows you to disable writting to disk cache. This option in in the php.ini file.

  4. Steve Says:

    The option is:

    eaccelerator.shm_only

    Enable or disable caching of compiled scripts on disk. This has no effect on session data and content caching. Default value is “0″ which allows eAccelerator to use disk and shared memory cacche for scripts.

    I hope that helps. =)

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.