Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Just installed php5-fpm. All sources say that apc module has been replaced with OPcache and it's compiled by default but not enabled.

How can I enable this module. I can not find opcache.so file on my server

I have checked /usr/lib/php5 and /etc/php5 but can not find it.

php -v
PHP 5.4.4-14+deb7u4 (cli) (built: Aug 23 2013 14:37:41)
share|improve this question

3 Answers 3

You can update PHP like shaun m says, or if you don't want to do that you can install zendopcache from PECL

Check for latest version here, this installs version 7.0.3.

Install "pecl" via php-pear

`sudo apt-get install -y php-pear`

Install build dependencies

sudo apt-get install -y build-essential php5-dev

Install Zend OpCache

sudo pecl install zendopcache-7.0.3

Find the location of opcache.so

sudo find / -name 'opcache.so'

Mine is

/usr/lib/php5/20100525/opcache.so

Now create opcache.ini

sudo vim /etc/php5/mods-available/opcache.ini

Add this info

zend_extension=/usr/lib/php5/20100525/opcache.so # File path from above
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

Now create a symlink for the conf file

sudo ln -s /etc/php5/mods-available/opcache.ini /etc/php5/conf.d/20-opcache.ini

Restart services

sudo service php5-fpm restart
sudo service apache2 restart

Confirm install

php -v

It should give mention of

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

Then (optionally) finish by cleaning up

sudo apt-get remove --purge build-essential php5-dev

Reference

share|improve this answer

OPCache is only enabled and compiled in by default in the new PHP 5.5, not the 5.4 that comes with Wheezy. If you'd like to use OPCache and PHP 5.5 in Debian, you'll have to add the dotdeb repos (see below) and install from there.

deb http://packages.dotdeb.org wheezy-php55 all 
deb-src http://packages.dotdeb.org wheezy-php55 all
share|improve this answer

You can install APC whit pecl

pecl install apc

php-pear en php-dev is needed for install it.

Or you can install whit apt-get

apt-get install php5-apc
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.