How I Fixed: apcu.so: cannot open shared object file

I recently updated all my Ansible build scripts to PHP7, and shortly after, my built boxes started throwing this annoying error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/apcu.so' - /usr/lib/php/20151012/apcu.so: cannot open shared object file: No such file or directory in Unknown on line 0

There’s no indication as to where this acpu.so  file is attempted to be loaded from.

I am using an Ubuntu box and all I could find was help for CentOS. Dammit, I have been meaning to make the switch for a while now, but I just haven’t yet found the time.

Anyway, after a bit of Google-fu, I found a quick way to find the file:

$ grep -Ril "apcu.so" /etc/php
/etc/php/7.0/cli/conf.d/20-apcu.ini
/etc/php/7.0/apache2/conf.d/20-apcu.ini

And from there, the fix is easy:

$ vim /etc/php/7.0/cli/conf.d/20-apcu.ini

and inside the file, comment out the line mentioning apcu.so

 1 ;extension=apcu.so

Problem solved.

Published by

Code Review

CodeReviewVideos is a video training site helping software developers learn Symfony faster and easier.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.