Skip to content

Did you know?

PHP 8.5 has OPcache built in, so there is no php8.5-opcache package to install.

Drop "opcache" from extension lists for PHP 8.5, or apt stops with "Unable to locate package".

  • Web servers
  • Applies to PHP 8.5 and later (Ubuntu, Debian)
  • Last checked

Explained

Starting with PHP 8.5, OPcache is no longer an optional extension: it is compiled into PHP itself and is always available. That changes how you install extensions on Ubuntu and Debian.

With PHP 8.4 and older, OPcache came as a separate package, so many install scripts and guides include it in the extension list:

sudo apt install php8.4-{mysql,curl,mbstring,xml,opcache} -y

If you copy that line and just change 8.4 to 8.5, apt stops with “Unable to locate package php8.5-opcache”, and nothing in the list gets installed. Simply leave opcache out:

sudo apt install php8.5-{mysql,curl,mbstring,xml} -y

You still configure OPcache the usual way, with the opcache.* settings in php.ini (for example opcache.memory_consumption), and you can confirm it is active with php -v, which prints a “with Zend OPcache” line. Update your provisioning scripts, Dockerfiles and Ansible roles when you move them to PHP 8.5.

Learn more

← All tech tips · Suggest a fix

Back to top