Installation of IMAP extension in Debian server php various error resolution process
Due to business needs, I need to execute QQ mailbox login in php and get back the mail in QQ mailbox. The server is the DEBIAN server, and the environment is the php environment installed by docker. Use the imap_open function in PHP to open the mailbox connection (remember to turn on the IMAP function in the mail settings). The php_imap extension needs to be installed to execute the imap_open function.If it is under windows, remove the php_imap.dll extension comment.
Fatal error: Uncaught Error: Call to undefined function imap_open() in D:\mail.php:10 Stack trace: #0 {main} thrown
Who works with NT systems, can open the file "\xampp\php\php.ini" to active the php exstension by removing the beginning semicolon at the line ";extension=php_imap.dll".Should be: extension=php_imap.dll
However, installing the imap extension in the docker environment of the Debian server still encountered a problem. Go directly to the php container under docker and start the installation. Error: configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.This should not happen.Check config.log for additional information.
[email protected]:/var/www# docker-php-ext-install imap
checking for IMAP Kerberos support...no
checking for IMAP SSL support...no
checking for utf8_mime2text signature...new
checking for U8T_DECOMPOSE...
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.This should not happen.Check config.log for additional information.
I looked for the libc-client-devel module to be installed, but I found that the module name is only suitable for centos, etc., and it cannot be installed on the Debian server.Error E: Unable to locate package libc-client-devel is reported because it is not called at all.This name. https://packages.debian.org/jessie/libc-client-dev Here is the full name of this package under debian. You can also use apt-cache search libc-client to search for related packages and find that you need to use ibc-client2007e-dev.
#Execute apt-get install libc-client-devel under the debian server will report that the package file cannot be found
[email protected]:~$ sudo apt-get install libc-client-devel
Reading package lists...Done
Building dependency tree
Reading state information...Done
E: Unable to locate package libc-client-devel
#Search and find through apt-cache search libc-client
[email protected]:~$ sudo apt-cache search libc-client
libc-client2007e-c-client library for mail protocols-library files
libc-client2007e-dev-c-client library for mail protocols-development files
uw-mailutils-c-client support programs
#Need to use as follows
[email protected]:/var/www# apt-get install libc-client2007e-dev
Reading package lists...Done
Building dependency tree
Reading state information...Done
......
After this operation, 3816 kB of additional disk space will be used.
Do you want to continue? [Y/n] y......
But it is still not over, and an error was reported during installation: configure: error: This c-client library is built with Kerberos support.Add --with-kerberos to your configure line.Check config.log for details.Let us see the prompt Add some options at the back, so add the options and then perform the installation.
[email protected]:/var/www# docker-php-ext-install imap
checking for utf8_mime2text signature...new
checking for U8T_DECOMPOSE...
checking for pam_start in -lpam...yes
checking for crypt in -lcrypt...yes
configure: error: This c-client library is built with Kerberos support.
Add --with-kerberos to your configure line.Check config.log for details.
#Prompt to add --with-kerberos when installing, add options and then perform the installation
[email protected]:/var/www# docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap
checking for crypt in -lcrypt...yes
checking for krb5-config...no
configure: error: Kerberos libraries not found.
Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr)
The option is added, but the added option does not work as prompted, because the Kerberos libraries cannot be found in the default path.The reason is that the Kerberos libraries are not installed. So execute the installation of libkrb5-dev library.After this step is successful, install imap again and it will be successful.
#Install libkrb5-dev library
[email protected]:/var/www# apt-get install libkrb5-dev
#Finally execute the installation imap installation is successful:
[email protected]:/var/www# docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap
#If you have already installed it, you can also try to use the following command to specify the directory of the kerberos library
docker-php-ext-configure imap --with-kerberos-inc=/usr/include --with-imap-ssl && docker-php-ext-install imap
30 Comments