Alternative PHP Caching FTW

Posted by Nessa | Posted in , | Posted on June 27, 2008

4

.!.

We get a TON of requests for the PHP APC pecl module because after having adopted suPHP into our configuration, eAccelerator is worthless. It’s quick to install, and especially if you’re running suPHP or phpsuexec, each user can maintain their own settings within their local php.ini without me having to do anything — basically the best thing that a lazy system admin can ask for.

Soooo, here’s how you install it:


wget http://pecl.php.net/get/APC-3.0.17.tgz
tar -xvzf APC-3.0.17.tgz

phpize
./configure && make && make install

Then just add “extension=/apc.so” to your php.ini and you’re done. With PHP under Apache this will load the APC module for everyone, but for suPHP users you’ll need to add it to their php.ini which will also allow them to modify their own APC settings. These are the ones I recommend using:

apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 30
apc.optimization = 0
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 1000
apc.mmap_file_mask = /tmp/apc.XXXXXX

Now, if you want to get even sexier with it I came across this little tool that monitors the performance of APC on your server.

Share and Enjoy:
  • Digg
  • DZone
  • del.icio.us
  • Technorati
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Twitter
  • Sphinn
  • Mixx
  • blogmarks
  • Furl
  • Reddit
  • Slashdot
  • RSS

No related posts.

Comments (4)

HAving trouble getting apc to work on CentOS 5, allthough the install goes fine using these coammands: http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html

APC doesn´t start and gives the error:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/apc.so’ – /usr/lib/php/modules/apc.so: cannot open shared object file: Permission denied in Unknown on line 0

Help would really be appreciated

do you have SElinux enabled on your box? Esp. on webhosting servers, it tends to be a nuisance — you might want to disable or set it to be permissive

Just wondering how its supposed to work. I’ve put the php.ini inside my public_html with those settings enabling APC.

When i use the APC gui, it only says that 1 page has hit and miss and thats it. Nothing else, no other PHP files get cached. Not sure if i need more PHP files running or is there a certain type of PHP page it will cache (e.g. with DB or complex scripting)?

I am running suPHP as well with PHP4/5.

APC is working zith suPHP ? I tought that with suPHP there is a new PHP process for each request and so the cache can’t be shared ?

Post a comment