Unable to install php extension

Hello. I’m unable to install imap php extension. The problem probably is, that I installed php version from php-archive github) and now I have php links broken?

Well, I followed every step from here: to install php with pthreads. It works perfectly, but when I want to install imap extension, I probably use other version of the extension?

Is I understood, installing extension should be easy as: $ sudo apt-get install php-imap $sudo phpenmod imap

Then extension (imap) should appear on: $ php -m

But this doesn’t happen, so I tried to add it manually (this is probably not how you want do it, I don’t know)

  • I copied file from “/usr/lib/php/20170718/” into my: “/etc/php7/lib/php/extensions/debug-zts-20170718/”.
  • I added “extension=imap” to my php.ini file

The problem now is displaying error:

“PHP Warning: PHP Startup: Unable to load dynamic library ‘imap’ (tried: /etc/php7/lib/php/extensions/debug-zts-20170718/imap (/etc/php7/lib/php/extensions/debug-zts-20170718/imap: cannot open shared object file: No such file or directory), /etc/php7/lib/php/extensions/debug-zts-20170718/ (/etc/php7/lib/php/extensions/debug-zts-20170718/ undefined symbol: file_globals)) in Unknown on line 0”

As I read, “undefined symbol: file_globals” probably means that I have wrong php API version of this extension to compile with php version. Or it has something to do with using zts?

I’m using Ubuntu 16.04 and I was literally searching for 10 hours to fix this, but I’m kinda php and Ubuntu beginner.

Any help would be highly appreciated! Thank you

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Make sure you’re installing the correct version of imap for PHP version you’re running. In other words, is php-imap for php 7.2? Also, is the php you’re running from the CLI actually php version 7.2 (php -v) or some other php version?