Search code examples
phpcomposer-phpopcache

Why won't composer use OPcache?


I added

"require": {
    "ext-opcache": "*",

to composer.json for an eDirectory Symfony 2.8 app, but it gave me an error:

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-opcache * is missing from your system. Install or enable PHP's opcache extension.

However, I do have OPcache installed!

$ php -r "phpinfo();" | grep OPcache -a3
Zend OPcache

Opcode Caching => Up and Running
Optimization => Enabled

It doesn't complain about "ext-gd": "*" or "ext-mbstring": "*".

PHP 5.6.27


Solution

  • The extension name is Zend OPcache not OPcache. You need to require it with full name:

    "ext-zend-opcache": "*"